文理学院程序设计在线练习


Attack Overflow

Time Limit: 2 Second(s)    Memory Limit: 32 MB

Total Submission(s): 77   Accepted Submission(s): 23
Problem Description

Anying likes to play the game of Hearthstone, especially when kill the opponent hero and make attack overflow,he will feel quite good.
Now,we assume this round Anying has N servants could attack the opponent hero once,we assume di is the i-th servant’s damage.
You can specify the order of attacks and the HP of opponent hero is M,when HP less than or equal to zero,you can’t attack any more and the game over.
What is the maximum damage Anying can cause.

Input

The first line is the number of test cases T(T<=40).
The first line of each case contains two integers N and M.
The second line contains N integers di , defines the damage of each servants.
(0<=N<=1000,0<=M<=1000,0<= <=1000)

Output

For each test case, output one line that contains an integer equals to the maximum damage.

Sample Input
2
3 100
1 2 3
3 5
2 4 4
Sample Output
6
8
Source

2014市赛