URI Online Judge | 2719

How Many Trips Will Noel Make?

By Cristhian Bonilha, UTFPR BR Brazil

Timelimit: 1

It's almost all ready! The gifts are wrapped, the routes are traced, the reindeer are fed and Noel is happy. It's nearly the time to leave, and Noel must deliver N gifts this Christmas.

The only problem is that all of these gifts may be too heavy to be loaded on a single trip.

To solve this problem, Noel stipulated the maximum weight that the sum of the gifts' weight can have on each trip, and now he wants to find out how many trips he will have to make.

Given the number of gifts, the maximum allowed weight for each trip, and the weight of the gifts, find out how many trips it will take to deliver all the gifts. Notice that the gifts must be delivered on the same order they are given on the input description.


There will be T test cases.

Each test case starts with two integers N and M, indicating how many gifts must be delivered and what is the maximum weight allowed for each trip, respectively (1 <= N <= 10*, or 1 <= N <= 10000**, 1 <= M <= 1000).

Following there will be N integers pi, each representing the weight of a gift (1 <= pi <= M, for every 1 <= i <= N).

* Will happen in approximately 90% of the test cases.
** Will happen in approximately 10% of the test cases.


For each test case print one row, containing one integer K, representing the amount of trips Noel will have to make.

Input Sample Output Sample

3 10
3 3 3
3 10
5 6 4