| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
| JU Cup 2026 |
|---|
| Finished |
On a farm owned by Void and Abukhass near the University of Jordan, there are $$$n$$$ sheep. They want to shear as many sheep as possible using a single pair of shears.
The shears have an initial durability of $$$X$$$. Shearing the $$$i$$$-th sheep decreases the durability of the shears by $$$a_i$$$. The shears break if their durability drops below zero, meaning they can only shear a sheep if $$$a_i$$$ is less than or equal to the remaining durability.
What is the maximum number of sheep they can successfully shear?
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — denotes the number of test cases.
The first line of each test case contains two space-separated integers $$$n$$$ and $$$X$$$ $$$(1 \le n \le 10^5, 1 \le X \le 10^{14})$$$ — denotes the number of sheep and the initial durability of the shears.
The second line contains $$$n$$$ space-separated integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — denotes the durability cost to shear each sheep.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print a single integer on a new line — the maximum number of sheep Void and Abukhass can shear.
44 103 4 2 53 56 7 83 1001 2 32 10000000000001000000000 1000000000
3032
| Name |
|---|

