## Another Contest 8 Problem 2 - Unnecessary Trash Push

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem type

Brandon likes to detonate fireworks. However, fireworks leave behind a lot of trash. Brandon has adjusted the Trash Push to clear out arbitrary trash, but the Trash Push is extremely tiring to perform after every firework detonation. Brandon wonders if some of his Trash Pushes are unnecessary.

We will model how Brandon takes out the trash as follows - he has infinitely many trash cans that can store up to units of trash. Over the course of days, Brandon will detonate some fireworks. On day , Brandon will accumulate units of trash. When Brandon executes a Trash Push, he takes all the trash he has and pushes it into a trash can. As before, the trash that overflows will automatically enter another trash can. A Trash Push is unnecessary if, after executing it, no trash can is completely full of trash. Brandon can execute a Trash Push at any time, as long as he has at least one unit of trash to push. After executing a Trash Push, Brandon takes all trash cans that have trash in them and takes them outside. They are emptied overnight and Brandon brings them back in the next day.

Given the amount of trash Brandon will generate over the next days, compute the maximum number of Trash Pushes Brandon can perform, given that none of them are unnecessary.

#### Constraints

The sum of all in an input file will not exceed .

#### Input Specification

The first line contains a single positive integer , the number of test cases.

test cases follow.

Each test case starts with a line containing two space-separated positive integers, and . The next line contains space-separated integers, the values.

Test cases are independent - at the beginning of a test case, you may assume Brandon always has zero trash.

#### Output Specification

Output lines. On the th line, output the maximum number of Trash Pushes Brandon can perform, given that none of them is unnecessary for the th test case.

#### Sample Input

3
3 1
1 2 3
3 3
1 2 3
3 39
31 41 59

#### Sample Output

3
2
2