Hide

Problem C
Qualification Round

You’ve just advanced from the Qualification Round of Google Code Jam Africa 2010, and you want to know how many of your fellow contestants advanced with you. To give yourself a challenge, you’ve decided only to look at how many people solved each problem.

The Qualification Round consisted of $P$ problems; the $i$-th problem was fully solved by $S_ i$ contestants. Contestants had to solve $C$ problems in order to advance to the next round. Your job is to figure out, using only that information, the maximum number of contestants who could have advanced.

Input

The first line of the input gives the number of test cases, $T$. T lines follow. Each will consist only of space-separated integers: first $P$, then $C$, then P integers $S_0, \dots , S_{P-1}$.

You may assume that $1 \leq T \leq 100, 1 \leq C \leq P, 1 \leq P \leq 60, 0 \leq S_{i} \leq 10^{17}$.

Output

For each test case, output one line containing “Case #$X$: $Y$”, where $X$ is the case number (starting from 1) and $Y$ is the maximum number of contestants who could have advanced (in other words, the maximum number of contestants who could have solved at least $C$ problems).

Sample Input 1 Sample Output 1
2
2 2 73 100
3 2 245 272 238
Case #1: 73
Case #2: 377

Please log in to submit a solution to this problem

Log in