#Lutece0387. Day Day Bath
Day Day Bath
Migrated from Lutece 387 Day Day Bath
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Bathing is a normal thing for the students in SCU.But for a school like SCU, too many students ,too little Bathroom. xy is a bathing-like girl. So she bathes everyday. However, with so many students waiting to bathe, it's a time-wasting thing to bathe. Now there are many students before her waiting to bathe .How long must her wait?
Input
The first line is an integer for test cases.
For every test case, the first line of an input contains two integer and ( for the number of students before her (), for the number of shower positions ( ) )
The next lines contain numbers (the bathing time for the person, ), one number per line.
Assume it takes no time to come in or out.
Output
The output file contains lines ,each for one test case.
Each line contains one number, the time before her turn.
If the time is greater than , print -1
.
Samples
1
2 3
19
30
0
Note
The data used in this problem is unofficial data prepared by pfctgeorge. So any mistake here does not imply mistake in the offcial judge data.
Resources
9th SCU Programming Contest Final