Problem: You are given an integer array and integer .
In one step you can
- either choose some index and decrease by one (make );
- or choose two indices and and set equal to (make ).
What is the minimum number of steps you need to make the sum of array ? (You are allowed to make values of array negative).
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and (; ) — the size of array and upper bound on its sum.
The second line of each test case contains integers () — the array itself.
It's guaranteed that the sum of over all test cases doesn't exceed .
Output Format: For each test case, print one integer — the minimum number of steps to make .
Note: In the first test case, you should decrease times to get the sum lower or equal to .
In the second test case, the sum of array is already less or equal to , so you don't need to change it.
In the third test case, you can, for example:
- set ;
- decrease by one, and get .
In the fourth test case, you can, for example:
- choose and decrease in by one times; you'll get ;
- choose elements , , and and them equal to .