Garland#12286

Garland

1.5 seconds
256 megabytes
Medium

In the magical land of Rudolandiya, the garlands for New Year trees are also magical. The foxes have developed a garland for which the state of all bulbs in a prefix can be changed. That is, each fox can choose any prefix of the garland and toggle the state of each bulb to the opposite:

This year, the foxes made a garland with bulbs for their main New Year tree.

foxes came to decorate the main tree, and each was allowed to choose any prefix and toggle it. The history of the toggles was recorded on a piece of paper, but then a little fox came and changed the order of operations and possibly some values of the operations.

The foxes were very concerned about this, as they wanted to know how to repeat the same pattern on the garland, so they turned to you. They provided you with the current state of each of the bulbs in the garland and the history they have after the little fox's mischief.

You know that initially, each bulb was off. Tell the foxes if there exists any permutation of the operations in the history that can achieve the same pattern on the garland.

Input

The first line contains a single integer (1 \le t \le 10^4) — the number of test cases.

The first line of each test case contains two integers and (1 \le n, k \le 10^6) — the number of bulbs in the garland and the number of foxes, respectively.

The second line of each test case contains an array of length (0 \le a_i \le 1) — the state of each bulb.

The third line of each test case contains an array of length (1 \le p_i \le n) — the values of the prefixes chosen by the foxes.

It is guaranteed that the sum of all and the sum of all across all test cases do not exceed 10^6.

Output

For each test case, output Yes if such a permutation of operations exists or No if such a permutation does not exist.

Examples

Example 1

Loading
Loading

Note

For the first test case, the answer is Yes since the foxes can perform the operations in the order: .

For the second test case, the answer is No since it can be proven that no such permutation of operations exists.

Scoring

  1. Subtask ( points): (1 \le k \le 20)

  2. Subtask ( points): (1 \le n, k \le 5000)

  3. Subtask ( points): (All p_i are distinct)

  4. Subtask ( points): (1 \le n, k \le 2 \cdot 10^5)

  5. Subtask ( points): No additional constraints