The Jury's Best Median
At the regional baking contest, n judges sit side by side along one long table, numbered 1 to n from left to right. Judge i has already written down a score a_i for the contestant's cake.
The organiser, who is quite fond of this particular cake, is allowed to choose which judges form the official panel, subject to two rules:
- the panel must be a group of judges sitting next to each other, that is, judges
l, l+1, …, rfor some1 ≤ l ≤ r ≤ n; - the panel must contain at least
kjudges, that is,r − l + 1 ≥ k.
The panel's verdict is computed like this: write down the scores of its m = r − l + 1 judges, sort them in non-decreasing order, and take the score in position ⌈m/2⌉ (positions counted from 1). So a panel of 5 judges takes its 3rd smallest score, and a panel of 4 judges takes its 2nd smallest score: for an even-sized panel it is the lower of the two middle scores. Equal scores are kept as separate entries when sorting.
Find the largest verdict the organiser can achieve.
Input
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 2·10^5).
The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), the judges' scores from left to right.
Output
Print one integer: the largest possible verdict over all allowed panels.
Notes
In the first example the panels of exactly three judges have verdicts 4 (scores 4 1 5), 2 (1 5 2) and 3 (5 2 3). Larger panels do no better: judges 1–4 give sorted scores 1 2 4 5 and verdict 2, and all five judges give verdict 3. The answer is 4.
In the second example every panel of two judges contains a low score, and because an even panel takes the lower middle score, each of them has a verdict of at most 3. The panel of judges 1–3 has sorted scores 2 7 8 and verdict 7, which is the best possible.