文理学院程序设计在线练习


Sum of Subsequence

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 88   Accepted Submission(s): 15
Problem Description

There are a sequence of numbers a1, a2, ..., an, and a number m. You should choose some numbers from the sequence and the sum of numbers is divisible by m.

Input

The first line is a positive integer T (T<=20), which represents the number of cases.
For each case, the first line contains two positive integers n, m (1<=n<=1,000,000; 1<=m<=1,000).
The second line contains n integers a1, a2, ..., an (0 <=ai <= 1,000,000,000).

Output

Output one line per case, either "YES" (without the quotes) if you can choose the subsequence that the sum of numbers in it is divisible by m, or "NO" (without the quotes), if such subsequence doesn't exist.

Sample Input
2
3 6
1 2 3
3 7
1 2 3
Sample Output
YES
NO
Source

2018绍兴市联赛