#P1852A. Ntarsis' Set
Ntarsis' Set
No submission language available for this problem.
Description
Ntarsis has been given a set , initially containing integers in sorted order. Every day, he will remove the -th, -th, , -th smallest numbers in simultaneously.
What is the smallest element in after days?
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case consists of two integers and () — the length of and the number of days.
The following line of each test case consists of integers () — the elements of array .
It is guaranteed that:
- The sum of over all test cases won't exceed ;
- The sum of over all test cases won't exceed ;
- for all test cases.
For each test case, print an integer that is the smallest element in after days.
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case consists of two integers and () — the length of and the number of days.
The following line of each test case consists of integers () — the elements of array .
It is guaranteed that:
- The sum of over all test cases won't exceed ;
- The sum of over all test cases won't exceed ;
- for all test cases.
Output
For each test case, print an integer that is the smallest element in after days.
Note
For the first test case, each day the -st, -nd, -th, -th, and -th smallest elements need to be removed from . So after the first day, will become $\require{cancel}$ . The smallest element is .
For the second case, each day the -st, -rd, -th, -th and -th smallest elements need to be removed from . will be changed as follows:
Day | before | after | |
1 | |||
2 | |||
3 |
The smallest element left after days is .