You are given an array consisting of distinct integers and an integer . You can choose any subsequence of size from the array in which the subsequence's elements are in sorted order, lowest to highest. Your task is to calculate the maximum possible median among the subsequence you can choose. If there is no such subsequence, print .
A subsequence of a given sequence is a sequence that can be derived from the given sequence by deleting some or no elements without changing the order of the remaining elements.
A median of a sequence of integers of length is the number standing on the -th (rounding up) position in the increasing ordering of its elements. Positions are numbered starting from . For example, a median of the sequence is the -th element, so it is . There exists other definitions of the median, but in this problem, we use the described definition.
The first line contains one integer the number of test cases. Then cases follow.
The first line of each test case contains two space-separated integers: and .
The second line of each test case contains space-separated integers the array . It is guaranteed that all elements are distinct.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output the maximum possible median. If no such median exists, print .
Input | Output |
---|---|
3 4 2 1 2 4 3 4 3 1 5 3 4 2 2 2 1 | 2 3 -1 |