Game of Division
Contest: Codeforces Round 992 (Div. 2)
Difficulty rating: 800
Tags: games, math

You are given an array of integers $$$a_1, a_2, \ldots, a_n$$$ of length $$$n$$$ and an integer $$$k$$$.

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

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

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

Input format:
Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \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 $$$n$$$ and $$$k$$$ ($$$1 \le n \le 100$$$; $$$1 \le k \le 100$$$) — the length of the array and the number $$$k$$$.

The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 100$$$) — the elements of the array $$$a$$$.

Output format:
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 $$$1 \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.

Constraints:
Time limit: 1.0 s
Memory limit: 256.0 MB

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

- If the second player chooses $$$a_1 = 1$$$, the resulting difference is $$$|2 - 1| = 1$$$ which is not divisible by $$$k = 2$$$.
- If the second player chooses $$$a_3 = 3$$$, the resulting difference is $$$|2 - 3| = 1$$$ which is not divisible by $$$k = 2$$$.

In the second test case:

- If the first player chooses $$$a_1 = 1$$$ and then the second player chooses $$$a_4 = 5$$$, the resulting difference is $$$|1 - 5| = 4$$$ which is divisible by $$$k = 2$$$.
- If the first player chooses $$$a_2 = 2$$$ and then the second player chooses $$$a_3 = 4$$$, the resulting difference is $$$|2 - 4| = 2$$$ which is divisible by $$$k = 2$$$.
- If the first player chooses $$$a_3 = 4$$$ and then the second player chooses $$$a_2 = 2$$$, the resulting difference is $$$|4 - 2| = 2$$$ which is divisible by $$$k = 2$$$.
- If the first player chooses $$$a_4 = 5$$$ and then the second player chooses $$$a_1 = 1$$$, the resulting difference is $$$|5 - 1| = 4$$$ which is divisible by $$$k = 2$$$.

Example input:
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

Example output:
YES
2
NO
YES
3
NO
NO
YES
2
YES
1

Editorial:
$$$|x - y|$$$ is divisible by $$$k$$$ if and only if $$$x \mod k = y \mod k$$$. Let's split all numbers into groups according to the value $$$x \mod k$$$. The second player wins if he chooses a number from the same group. This means that the first player must choose the number that is the only one in its group.