#K3031. First Round Cumulative Score Problem

    ID: 24868 Type: Default 1000ms 256MiB

First Round Cumulative Score Problem

First Round Cumulative Score Problem

You are given t test cases. In each test case, you are provided with an integer n representing the number of rounds, an integer k representing the target score, and a list of n integers corresponding to the points obtained in each round. Your task is to determine the first round index j at which the cumulative sum of points, i.e. \(\sum_{i=1}^{j}a_i\), is greater than or equal to k. If the cumulative sum never reaches k, output -1 for that test case.

Note: The rounds are 1-indexed.

inputFormat

The input is given via stdin in the following format:

  • The first line contains an integer t, the number of test cases.
  • For each test case, the first line contains two integers n and k.
  • The second line of each test case contains n space-separated integers representing the points in each round.

outputFormat

For each test case, output one line containing a single integer: the 1-indexed round number where the cumulative score first reaches or exceeds k. If the target is never reached, print -1.

The output is printed to stdout.

## sample
4
5 10
1 2 3 4 5
3 6
1 2 3
4 15
5 5 5 5
5 20
3 3 3 3 3
4

3 3 -1

</p>