CF1791G1.Teleporters (Easy Version)

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Teleporters (Easy Version)

The only difference between the easy and hard versions are the locations you can teleport to.

Consider the points 0,1,,n0, 1, \dots, n on the number line. There is a teleporter located on each of the points 1,2,,n1, 2, \dots, n. At point ii, you can do the following:

  • Move left one unit: it costs 11 coin.
  • Move right one unit: it costs 11 coin.
  • Use a teleporter at point ii, if it exists: it costs aia_i coins. As a result, you teleport to point 00. Once you use a teleporter, you can't use it again.

You have cc coins, and you start at point 00. What's the most number of teleporters you can use?

Input

The input consists of multiple test cases. The first line contains an integer tt (1t10001 \leq t \leq 1000) — the number of test cases. The descriptions of the test cases follow.

The first line of each test case contains two integers nn and cc (1n21051 \leq n \leq 2\cdot10^5; 1c1091 \leq c \leq 10^9)  — the length of the array and the number of coins you have respectively.

The following line contains nn space-separated integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1091 \leq a_i \leq 10^9) — the costs to use the teleporters.

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot10^5.

Output

For each test case, output the maximum number of teleporters you can use.

Note

In the first test case, you can move one unit to the right, use the teleporter at index 11 and teleport to point 00, move two units to the right and use the teleporter at index 22. You are left with 61121=16-1-1-2-1 = 1 coins you don't have enough coins to use another teleporter. You have used two teleporters, so the answer is two.

In the second test case, you go four units to the right and use the teleporter to go to 00, then go six units right and use the teleporter at index 66 to go to 00. The total cost will be 4+6+6+4=204+6+6+4 = 20. You are left with 1212 coins, but it is not enough to reach any other teleporter and use it so the answer is 22.

In the third test case, you don't have enough coins to use any teleporter, so the answer is zero.

Samples

10
5 6
1 1 1 1 1
8 32
100 52 13 6 9 4 100 35
1 1
5
4 5
4 3 2 1
5 9
2 3 1 4 1
5 8
2 3 1 4 1
4 3
2 3 4 1
4 9
5 4 3 3
2 14
7 5
5 600000000
500000000 400000000 300000000 200000000 100000000
2
2
0
1
2
2
1
1
1
2

在线编程 IDE

建议全屏模式获得最佳体验