Being greedy for Water

4.1

7 votes
Very-Easy
Problem

You are given container full of water. Container can have limited amount of water. You also have N bottles to fill. You need to find the maximum numbers of bottles you can fill.

Input:
First line contains one integer, T, number of test cases.
First line of each test case contains two integer, N and X, number of bottles and capacity of the container.
Second line of each test case contains N space separated integers, capacities of bottles.

Output:
For each test case print the maximum number of bottles you can fill.

Constraints:
1T100
1N104
1X109
1capacitiesofbottles106

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

X=10
So the optimal way to fill the bottle is to fill bottles with capacities 2, 3 and 5. So the answer is 3.

Editor Image

?