Consider all the consecutive intervals of \(a[ ]\) which have at least \(K\) integers. We find the \(K\)-th largest element from each of such intervals, and add these elements into an array \(B\) which is initially empty. Notice that the same element can be added for multiple times. Obviously, finally the length of \(B\) is \(\frac{(n+2-K)(n+1-K)}{2}\).

For example, \(a=[4,5,5,8,6]\) and \(K=4\). Then the consecutive intervals with at least \(K=4\) integers are \([4,5,5,8], [5,5,8,6], [4,5,5,8,6]\). After finding the \(K\)-th largest elements, we get \(B=[4,5,5]\).

Do you know what is the \(M\)-th largest integer in array \(B[ ]\)?