CF2236D Brand New Tatar TV Show

Description

Dabir and Egor were not satisfied with the fame from the previous episode, so they decided to make another TV show: the guys play their favorite game on an array $ a $ with their favorite integer $ k $ . Dabir moves first. On the first move, any element from the array can be chosen and removed. Let the previous chosen element be equal to $ x $ . Then on the current move, except the very first one, a player must choose an element $ y $ from the array such that $ 0 \leq y - x \leq k $ and remove it from the array. The player who cannot make a move loses. But since this was not just a game, but a real show-match, Arseniy (aka MAKAN) — the main celebrity of Omsk was invited again. As a guest celebrity, Arseniy was given the opportunity to make the first move in this match, that is, to make the very first move in the game instead of Dabir. However, it turns out Arseniy is a fan of Egor, so he wants his first move to guarantee Egor a winning strategy against any response from Dabir. Determine whether Arseniy can make the first move for Dabir so that, no matter how Dabir plays, Egor wins.

Input Format

Each test consists of multiple test cases. The first line contains a single integer $ t $ ( $ 1 \leq t \leq 10^4 $ ) — the number of test cases. The first line of each test case contains two integers $ n $ and $ k $ ( $ 1 \leq n, k \leq 2 \cdot 10^5 $ ) — the length of the array and the favorite integer of Dabir and Egor. The second line contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \leq a_i \leq n $ ). It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

Output Format

For each test case, if there exists such a first move that with optimal play by both players Egor wins, output "YES", otherwise output "NO". You can output "YES" and "NO" in any case (for example, "yES", "yes", and "Yes" will be accepted).

Explanation/Hint

In the first example, the only possible option is to choose the integer $ 3 $ . After that, the array \[ $ 3, 3, 3, 3 $ \] remains. Then Egor moves, then Dabir, and so on. Dabir will take the last $ 3 $ , so Arseniy cannot choose a first move that makes Egor win. In the second example, Arseniy can choose the integer $ 1 $ as the first move. Then Egor will choose the integer $ 2 $ , and Dabir will have no valid moves left, so Egor wins.