Problem B: Peaceful Multiset

## Problem B: Peaceful Multiset

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 199  Solved: 60
[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


[Submit][Status]