Normally people post code here when it is not doing what they want it to. The usual complaint is "It doesn't work!" Which is completely unhelpful.
You are making decisions on the values in val2[] before you put any values into that array. The array is local to loop() which means it goes out of scope when loop() ends. Any other code may use that area of memory at that point. Now the Arduino is so simple that there isn't any other code that will overwrite that memory, so the LEDs will turn on and off based on the values you put in there on the previous iteration of loop().
A bigger problem is running off the end of val2[] and expecting to find values there. Additionally, cnt1 and cnt2 seem to be unbounded and they can also run off the end of their arrays and start writing values to nearby areas of memory. Even though there aren't 100 local maxima or minima in a 256-sample array, you might increase the number of samples in the future and then you'll have some very difficult bugs to find.
I'm sure there's more bugs. I just can't keep ind1[] and val2[] in my head long enough to find them. Please give them names. Also give the array sizes names, so you don't have "256" and "100" scattered throughout the code. Replace them with inputArraySize and localMaxArraySize or other names which are meaningful to you.