Sakurako's Birthday#11712

Sakurako's Birthday

1 second
256 megabytes
Easy

Today is Sakurako's birthday, so you decided to make a good present. You think that the best present will be an array of equal integers. Unfortunately, you couldn't find such an array. However, you are clever and can change any element in the array by exactly in one operation. In other words, if you have an array , you can choose an integer (1 \leq i \leq n) and replace a_i with either a_i - k or a_i + k. You want to make Sakurako happy, so you need to decide whether you can make all elements of the array equal.

For example, if you have the array [10, 16, 12, 10, 20] and k = 2, you can make all elements equal to . To do this, add to the first and fourth elements (a_1 + k = 10 + 2 = 12), subtract from the second element two times (a_2 - 2 \cdot k = 16 - 4 = 12), do not change the third element, and subtract from the fifth element four times (a_5 - 4 \cdot k = 20 - 8 = 12).

Input

The first line contains one integer (1 \leq t \leq 10^5) — the number of arrays.

Each array is described in two lines.

The first line contains two integers and (1 \leq n \leq 2 \cdot 10^5, 1 \leq k \leq 10^9).

The second line contains integers a_1, \ldots, a_n (1 \leq a_i \leq 10^9).

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

Output

For each array, print "YES" if you can make all elements equal, or "NO" otherwise.

Examples

Example

Loading
Loading

Note

The first example was explained above.

In the second example, the answer is "YES" because you can make all the numbers equal to .

In the third example, the answer is "NO" because it can be proven that the fifth element cannot be made equal to any other element of the array after any number of operations.

Scoring

  1. (3 points): k = 2;

  2. (8 points): a_i \leq 100 for all arrays;

  3. (18 points): n \leq 1000 for all arrays; it is guaranteed that the sum of over all test cases does not exceed .

  4. (21 points): without additional restrictions.