CF2065C1.Skibidus and Fanum Tax (easy version)

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

Skibidus and Fanum Tax (easy version)

This is the easy version of the problem. In this version, m=1m = 1.

Skibidus has obtained two arrays aa and bb, containing nn and mm elements respectively. For each integer ii from 11 to nn, he is allowed to perform the operation at most once:

  • Choose an integer jj such that 1jm1 \leq j \leq m. Set ai:=bjaia_i := b_j - a_i. Note that aia_i may become non-positive as a result of this operation.

Skibidus needs your help determining whether he can sort aa in non-decreasing order^{\text{∗}} by performing the above operation some number of times.

^{\text{∗}}aa is sorted in non-decreasing order if a1a2ana_1 \leq a_2 \leq \ldots \leq a_n.

Input

The first line contains an integer tt (1t1041 \leq t \leq 10^4) — the number of test cases.

The first line of each test case contains two integers nn and mm (1n21051 \leq n \leq 2 \cdot 10^5, m = 1\textbf{m = 1}).

The following line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \leq a_i \leq 10^9).

The following line of each test case contains mm integers b1,b2,,bmb_1, b_2, \ldots, b_m (1bi1091 \leq b_i \leq 10^9).

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

Output

For each test case, if it is possible to sort aa in non-decreasing order, print "YES" on a new line. Otherwise, print "NO" on a new line.

You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses.

Note

In the first test case, [5][5] is already sorted.

In the second test case, it can be shown that it is impossible.

In the third test case, we can set a3:=b1a3=62=4a_3:=b_1-a_3=6-2=4. The sequence [1,4,4,5][1,4,4,5] is in nondecreasing order.

In the last case, we can apply operations on each index. The sequence becomes [1,0,1][-1,0,1], which is in nondecreasing order.

Samples

5
1 1
5
9
3 1
1 4 3
3
4 1
1 4 2 5
6
4 1
5 4 10 5
4
3 1
9 8 7
8
YES
NO
YES
NO
YES

在线编程 IDE

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