Subset Sum

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

Chiaki has nn integers a_1,a_2,,a_na\_1, a\_2, \dots, a\_n and another integer cc, and she would like to choose a subset of the nn integers whose sum does not exceed cc. Find the maximum possible sum of the chosen subset.

입력

There are multiple test cases. The first line of the input contains an integer TT (1T2×1041 \le T \le 2 \times 10^4), indicating the number of test cases. For each test case:

The first line contains two integers nn and cc (1n2×1041 \le n \leq 2 \times 10^4, 1c1091 \leq c \leq 10^9). The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \dots, a\_n (1a_i2×1041 \leq a\_i \leq 2 \times 10^4). 

The sum of all nn does not exceed 2×1042 \times 10^4.

출력

For each test case, output an integer denoting the answer.