#C10045. Maximum Number of Sessions

    ID: 39207 Type: Default 1000ms 256MiB

Maximum Number of Sessions

Maximum Number of Sessions

Problem Description:

You are given a number of test cases. For each test case, you are provided with two integers: NN, the number of sessions, and HH, the total available hours. In addition, you are given a list of NN session durations. Your task is to determine the maximum number of sessions that can be scheduled such that the sum of the durations does not exceed HH.

The optimal strategy is to select the sessions with the shortest durations first. This ensures that you can fit as many sessions as possible within the given time constraint.

inputFormat

Input Format:

The first line of input contains an integer TT, the number of test cases. Each test case consists of two lines:
1. The first line contains two space-separated integers: NN (the number of sessions) and HH (the available hours).
2. The second line contains NN space-separated integers representing the durations of the sessions.

outputFormat

Output Format:

For each test case, print a single integer representing the maximum number of sessions that can be scheduled without exceeding the available hours. Each result should be printed on a new line.## sample

2
5 15
2 3 5 8 1
3 8
4 2 6
4

2

</p>