Stevie : "Integer sequences, that's my main activity off the pitch. Let's play with them". Great defenders are an asset to any team, just like this guy :
You are given a sequence of positive integers in the form of an array A of size N and a number K. Now, you need to perform a certain procedure over this sequence that is as follows :
-
For each pair \((i,j)\), where \( 1 \le i < j \le N \) store in a list \(|A[i]-A[j]|\)
-
Sort this list in non-decreasing order
-
Print the \(K^{th}\) element of this list (1 indexed)
Note that X denotes the absolute value of any integer X
You need to perform the following procedure and print to output whatever it leads to. Can you do it ?
input Format :
The first line contains 2 space separated integers N and K respectively. The next line contains N space separated integers, where the \(i^{th}\) integer denotes \(A[i]\).
Output Format :
Print the required answer on a single line.
Constraints :
\( 2 \le N \le 200,000 \)
\( 1 \le A[i] \le 10^9 \) , where \( 1 \le i \le N \)
\( 1 \le K \le (N \times (N-1))/2 \)