CF2040A.Game of Division

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

Game of Division

You are given an array of integers a1,a2,,ana_1, a_2, \ldots, a_n of length nn and an integer kk.

Two players are playing a game. The first player chooses an index 1in1 \le i \le n. Then the second player chooses a different index 1jn,ij1 \le j \le n, i \neq j. The first player wins if aiaj|a_i - a_j| is not divisible by kk. Otherwise, the second player wins.

We play as the first player. Determine whether it is possible to win, and if so, which index ii should be chosen.

The absolute value of a number xx is denoted by x|x| and is equal to xx if x0x \ge 0, and x-x otherwise.

Input

Each test contains multiple test cases. The first line of input contains a single integer tt (1t1001 \le t \le 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers nn and kk (1n1001 \le n \le 100; 1k1001 \le k \le 100) — the length of the array and the number kk.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1001 \le a_i \le 100) — the elements of the array aa.

Output

For each test case, if it is impossible for the first player to win, print "NO" (without quotes).

Otherwise, print "YES" (without quotes) and on the next line the appropriate index 1in1 \le i \le n. If there are multiple solutions, print any of them.

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer.

Note

In the first test case, the first player can choose a2=2a_2 = 2. Then:

  • If the second player chooses a1=1a_1 = 1, the resulting difference is 21=1|2 - 1| = 1 which is not divisible by k=2k = 2.
  • If the second player chooses a3=3a_3 = 3, the resulting difference is 23=1|2 - 3| = 1 which is not divisible by k=2k = 2.

In the second test case:

  • If the first player chooses a1=1a_1 = 1 and then the second player chooses a4=5a_4 = 5, the resulting difference is 15=4|1 - 5| = 4 which is divisible by k=2k = 2.
  • If the first player chooses a2=2a_2 = 2 and then the second player chooses a3=4a_3 = 4, the resulting difference is 24=2|2 - 4| = 2 which is divisible by k=2k = 2.
  • If the first player chooses a3=4a_3 = 4 and then the second player chooses a2=2a_2 = 2, the resulting difference is 42=2|4 - 2| = 2 which is divisible by k=2k = 2.
  • If the first player chooses a4=5a_4 = 5 and then the second player chooses a1=1a_1 = 1, the resulting difference is 51=4|5 - 1| = 4 which is divisible by k=2k = 2.

In any case, the second player wins.

Samples

7
3 2
1 2 3
4 2
1 2 4 5
5 3
10 7 3 4 5
5 3
1 31 15 55 36
2 1
17 17
2 2
17 18
1 3
6
YES
2
NO
YES
3
NO
NO
YES
2
YES
1

在线编程 IDE

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