10541054 SUSTech Online Judge
Problem 1054 --Peaceful Multiset

1054: Peaceful Multiset

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 197  Solved: 59
[Submit][Status][Web Board]

Description

Give you a multiset S. Could you find a subset T of S such that for all x, y belongs to T, (x – y) % m = 0 and |T| = k. |T| means the number of elements in set T.

Input

The first line will be three integers n, k, m. (2 <= k <= n <= 105, 1 <= m <= 105)

The second line will have n integers. The absolute value of the integer doesn’t exceed 109.

Output

Print YES if we can find such T, otherwise NO.

Sample Input

3 2 3
1 8 4

Sample Output

YES

HINT

Source

[Submit][Status]