#K2346. ATM Transaction Processing

    ID: 24716 Type: Default 1000ms 256MiB

ATM Transaction Processing

ATM Transaction Processing

In this problem, you are given multiple test cases, each representing a series of ATM transactions and a cash limit for the ATM. For each test case, determine the maximum number of consecutive transactions that can be processed without exceeding the ATM's cash limit. Transactions must be processed in order, and once a transaction would cause the cumulative sum to exceed the limit, no further transactions are processed. Formally, if the ATM limit is denoted by ll and the transactions are a1,a2,,ama_1,a_2,\dots,a_m, then you must find the maximum integer kk (starting from 0) such that $$\sum_{i=1}^{k}a_i\leq l.$$

inputFormat

The input begins with a single integer tt (t1t \ge 1) on a new line representing the number of test cases. For each test case, the first line contains two integers mm and ll, where mm is the number of transactions and ll is the ATM's cash limit. The following line contains mm space-separated integers representing the transaction amounts.

outputFormat

For each test case, output a single integer on a separate line representing the maximum number of consecutive transactions that can be processed without exceeding the ATM's cash limit.## sample

1
5 100
20 30 50 10 5
3