codeforces#P1734D. Slime Escape

Slime Escape

Description

You are playing a game called Slime Escape. The game takes place on a number line. Initially, there are nn slimes. For all positive integers ii where 1in1 \le i \le n, the ii-th slime is located at position ii and has health aia_i. You are controlling the slime at position kk.

There are two escapes located at positions 00 and n+1n+1. Your goal is to reach any one of the two escapes by performing any number of game moves.

In one game move, you move your slime to the left or right by one position. However, if there is another slime in the new position, you must absorb it. When absorbing a slime, the health of your slime would be increased by the health of the absorbed slime, then the absorbed slime would be removed from the game.

Note that some slimes might have negative health, so your health would decrease when absorbing such slimes.

You lose the game immediately if your slime has negative health at any moment during the game.

Can you reach one of two escapes by performing any number of game moves, without ever losing the game?

Each test contains multiple test cases. The first line contains a single integer tt (1t200001 \leq t \leq 20\,000) — the number of test cases. Description of the test cases follows.

The first line of each test case contains two positive integers nn, kk (3n2000003 \leq n \leq 200\,000, 1kn1 \leq k \leq n) — the number of slimes and the position of your slime.

The second line of each test case contains nn integers, a1,a2,,ana_1, a_2, \ldots, a_n (109ai109-10^9 \leq a_i \leq 10^9) — the health of the slimes.

It is guaranteed that health of your slime is non-negative (ak0a_k \geq 0), and all other slimes have non-zero health (ai0a_i \ne 0 for iki \ne k).

It is guaranteed that the sum of nn over all test cases does not exceed 200000200\,000.

For each test case, print "YES" (without quotes) if you can escape without losing, and "NO" (without quotes) otherwise.

Input

Each test contains multiple test cases. The first line contains a single integer tt (1t200001 \leq t \leq 20\,000) — the number of test cases. Description of the test cases follows.

The first line of each test case contains two positive integers nn, kk (3n2000003 \leq n \leq 200\,000, 1kn1 \leq k \leq n) — the number of slimes and the position of your slime.

The second line of each test case contains nn integers, a1,a2,,ana_1, a_2, \ldots, a_n (109ai109-10^9 \leq a_i \leq 10^9) — the health of the slimes.

It is guaranteed that health of your slime is non-negative (ak0a_k \geq 0), and all other slimes have non-zero health (ai0a_i \ne 0 for iki \ne k).

It is guaranteed that the sum of nn over all test cases does not exceed 200000200\,000.

Output

For each test case, print "YES" (without quotes) if you can escape without losing, and "NO" (without quotes) otherwise.

输入数据 1

6
7 4
-1 -2 -3 6 -2 -3 -1
3 1
232 -500 -700
7 4
-1 -2 -4 6 -2 -4 -1
8 4
-100 10 -7 6 -2 -3 6 -10
8 2
-999 0 -2 3 4 5 6 7
7 3
7 3 3 4 2 1 1

输出数据 1

YES
YES
NO
YES
NO
YES

Note

In the first test case, you control the slime at position 44 with health 66. One way to escape is to absorb the slimes at positions 55, 66, and 77. Your slime escapes with 00 health at position 88.

In the second test case, you control the slime with 232232 health at position 11. Since your slime is already located next to the escape at position 00, you can move to it without absorbing any slime.

In the third test case, it can be shown that your slime would always have a negative health before reaching any one of two escapes.

In the fourth test case, you control the slime at position 44 with health 66. The following describes a possible sequence of moves to win:

  1. Absorb the slimes at positions 55, 66, and 77: your health becomes 44 after absorbing the slime with health 2-2; becomes 11 after absorbing the slime with health 3-3; and becomes 77 after absorbing the slime with health 66.
  2. Absorb the slimes at positions 33, and 22: your health becomes 77+10=107-7+10=10.
  3. Absorb the slime at position 88: your health becomes 1010=010-10=0.
  4. Use the escape at position 99.

Since your slime has maintained non-negative health at all times, you have won.