#P1417A. Copy-paste
Copy-paste
Description
— That'll do it.
BThero is a powerful magician. He has got piles of candies, the -th pile initially contains candies. BThero can cast a copy-paste spell as follows:
- He chooses two piles such that and .
- All candies from pile are copied into pile . Formally, the operation is performed.
BThero can cast this spell any number of times he wants to — but unfortunately, if some pile contains strictly more than candies, he loses his magic power. What is the maximum number of times BThero can cast the spell without losing his power?
The first line contains one integer () — the number of test cases.
Each test case consists of two lines:
- the first line contains two integers and (, );
- the second line contains integers , , ..., ().
It is guaranteed that the sum of over all test cases does not exceed , and the sum of over all test cases does not exceed .
For each test case, print one integer — the maximum number of times BThero can cast the spell without losing his magic power.
Input
The first line contains one integer () — the number of test cases.
Each test case consists of two lines:
- the first line contains two integers and (, );
- the second line contains integers , , ..., ().
It is guaranteed that the sum of over all test cases does not exceed , and the sum of over all test cases does not exceed .
Output
For each test case, print one integer — the maximum number of times BThero can cast the spell without losing his magic power.
Note
In the first test case we get either or after casting the spell for the first time, and it is impossible to cast it again.