#SDNU1249. D.陆历川爱合并
D.陆历川爱合并
Description
Lulichuan have a sorted sequences, he want to merge these sequences,every time he can chose elements to merge, every operating cost the Sum of the sequnces, But the total cost should no more than , so Lulichuan want to know the samllest .
Format
Input
The first line of input contains an integer T_T, the number of test cases. T_T test cases follow. T_T For each test case, the first line consists two integers and T (∑Ni=1ai. In the next line there are N integers
Output
For each test cases, output the smallest
Samples
1
3 15
3 4 4
Case #1: 3
Hints
K = 2 sum = (3 + 4) + (3 + 4 + 4) > 15
K = 3 sum = 3 + 4 + 4 < 15