#C8573. Maximal Sequential Destinations
Maximal Sequential Destinations
Maximal Sequential Destinations
During your vacation, you want to visit as many destinations as possible in sequence starting from the first one. However, you have a limited number of vacation days. For each destination, a specific number of days is needed. Your task is to determine the maximum number of sequential destinations you can visit such that the total number of days required does not exceed the available vacation days (V). Formally, given a list of destinations with required days (d_1, d_2, \ldots, d_N), find the largest (k) such that (\sum_{i=1}^{k} d_i \le V).
inputFormat
The input begins with an integer (T), the number of test cases. For each test case, the first line contains two integers (N) and (V) — the number of destinations and the available vacation days respectively. The second line contains (N) space-separated integers, where the (i)-th integer denotes the number of days required to explore the (i)-th destination.
outputFormat
For each test case, output a single integer on a new line indicating the maximum number of sequential destinations that can be visited without exceeding the total available vacation days (V).## sample
1
5 10
1 2 3 4 5
4