Clarke and food

Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 65536/65536 K (Java/Others)

Description

Clarke is a patient with multiple personality disorder. One day, Clarke turned into a cook, was shopping for food.
Clarke has bought $n$ food. The volume of the $i$th food is $v_i$. Now Clarke has a pack with volume $V$. He wants to carry food as much as possible. Tell him the maxmium number he can brought with this pack.

Input

The first line contains an integer $T(1 \le T \le 10)$, the number of the test cases.
For each test case:
The first line contains two integers $n, V(1 \le n \le 10^5, 1 \le V \le 10^9)$.
The second line contains $n$ integers, the $i$th integer denotes $v_i(1 \le v_i \le 10^9)$.

Output

For each test case, print a line with an integer which denotes the answer.

Sample Input

1 3 5 1 3 4

Sample Output

2 Hint: We can carry 1 and 3, the total volume of them is 5.

Hint

hujie

Source

BestCoder Round #62 (div.2)

提交代码