#C2371. Pairs Divisible by K

    ID: 45680 Type: Default 1000ms 256MiB

Pairs Divisible by K

Pairs Divisible by K

You are given several test cases. For each test case, you are provided with an integer n, a divisor k, and an array of n integers. Your task is to determine whether there exists a pair of distinct elements in the array such that the sum of the two elements is divisible by k.

More formally, given an array \(a_1, a_2, \dots, a_n\), find if there exist indices \(i\) and \(j\) with \(i \neq j\) such that \[ (a_i + a_j) \mod k = 0. \]

If such a pair exists, output YES; otherwise, output NO.

inputFormat

The input is given via standard input (stdin) and has the following format:

T
n1 k1
a1 a2 ... an1
...
nT kT
a1 a2 ... anT

Here, T (\(T \ge 1\)) is the number of test cases. For each test case, the first line contains two integers, n and k. The next line contains n integers representing the elements of the array.

outputFormat

For each test case, print a single line containing either YES if there exists a pair of distinct elements whose sum is divisible by k, or NO otherwise. The output should be written to standard output (stdout).

## sample
3
5 3
1 7 2 4 5
4 2
3 1 9 6
4 5
1 1 1 1
YES

YES NO

</p>