P20352 [CodeChef] CK87MEDI
普及-
题目描述

Read problems statements in Mandarin chinese, Russian and Vietnamese as well.

Even though it was a little unexpected, Chef did it! He has finally opened a new restaurant!

As you all know, to make everything go well, Chef needs employees (co-chefs if you might say). Because Chef is a perfectionist, he planned to employ only chefs who are good at competitive progeamming. Hence, Chef asked for help from his friends Shahhoud and Said. Knowing that many people (such as Ahmad, Nour, Majd and Joud) will apply for the job, they decided to choose only the best appliers.

As the day of the employment came, people lined up in front of the restaurant applying for the job. Before accepting any appliers, Shahhoud and Said decided to make them answer a simple question, in order to determine which of them better deserves the job.

Given an array of N elements A_{1}, A_{2}, ..., A_{N}, each applier was asked to insert any K integers he wants to this array. Eventually, each applier will be asked to write down the median among all the elements in his resulting array. Many appliers asked for your help to determine what is the greatest median they can get after inserting any K elements they want?

Note that the median in an array is the element positioned at the center of the array after sorting it. E.g. the median in [2, 1, 5, 2, 4] is 2, and the median in [3, 3, 1, 3, 3] is 3.

------ Input ------

The first line of the input contains an integer T denoting the number of test cases.

The first line of each test case contains two space separated integers N and K denoting the array length, and the number of elements to be inserted.

The second line of each test case contains N space separated integers A_{1}, A_{2}, ..., A_{N} denoting the elements of the array.

------ Output ------

For each test case output a single line, containing a single integer, indicating the greatest median the applier can obtain after inserting exactly K new elements into the given array.

------ Constraints ------

$1 ≤ T ≤ 100.$
$0 ≤ K < N ≤ 100.$
$0 ≤ A_{i} ≤ 1000.$
$N + K is guaranteed to be odd.$

----- Sample Input 1 ------
3
2 1
4 7
4 3
9 2 8 6
5 2
6 1 1 1 1
----- Sample Output 1 ------
7
9
1
----- explanation 1 ------
Test case $1$: A possible solution is to add element $9$ to the array. On sorting, the array becomes $[4, 7, 9]$. The element positioned at the center, after sorting, is $7$. It can be shown that the median of the array after inserting $1$ element cannot exceed $7$.

Test case $2$: A possible solution is to add elements $10, 20, $ and $30$ to the array. On sorting, the array becomes $[2, 6, 8, 9, 10, 20, 30]$. The element positioned at the center, after sorting, is $9$. It can be shown that the median of the array after inserting $3$ elements cannot exceed $9$.

Test case $3$: A possible solution is to add elements $2$ and $3$ to the array. On sorting, the array becomes $[1,1,1,1,2,3,6]$. The element positioned at the center, after sorting, is $1$. It can be shown that the median of the array after inserting $2$ elements cannot exceed $1$.

输入格式

见题面

输出格式

见题面

样例输入
3 2 1 4 7 4 3 9 2 8 6 5 2 6 1 1 1 1
样例输出
7 9 1