The Sleeping Barber

1

1 votes
Problem

Most of you know that how much the sleeping barber loves sleeping, and the way he works. For those who don't know, it isn't important for now. Because the problem , that the sleeping barber is facing is a new one for him and because he forgot to take his coding pills, he is not able to tackle with it. Recently, the barber learned that making a 'group' one of your regular customers increases your profits.

As too many groups are coming to his shop, he is not able to decide the order in which he should serve the customers to maximize his profit.What he knows from his intellect is that how many groups will come on that day to his shop and the size of each group.He also knows his capacity of service for the day ( how many customers he can serve on that day ). He wants to know , what is the number of groups he can serve to maximize his profit.

Now it is your task to help the barber and tell him number of groups he can serve to maximize his profit on that day.You will be provided number of days D, number of groups coming for every day G and a list of G integers denoting the size of the group.Also the maximum capacity M of the barber will be given for that day.

*Input *

The first line contains a single integer D - the number of days. The D cases follow. First line of every case consists of a single integer G denoting number of groups and M denoting the maximum serving capacity of the barber. Second line of every case consists of G integers denoting the size of the groups.

*Output *

In D lines print D integers - the maximum numbers groups that barber can serve.

Constraints

1 <= D <= 157

1 <= G <= 2937

1 <= G[i] <= 10^8

1 <= M <= 10^12

*Problem Setter : *Shikhar Singh

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Day 1 : The barber can choose (1,2) or (1,3) or (1,4) or (2,3). In any case the maximum possible groups he can serve is 2.

Day 2 : On of the possible optimal solution's is ( 4,5 ).In any case the maximum number of groups he can serve is 2.

Editor Image

?