#include #include #include #include #include #include #include #include #include using namespace std; //#pragma comment(linker, "/STACK:1024000000,1024000000") #define FIN freopen("input.txt","r",stdin) #define FOUT freopen("output.txt","w",stdout) #define fst first #define snd second #define lson l, mid, rt << 1 #define rson mid + 1, r, rt << 1 | 1 typedef __int64 LL; //typedef long long LL; typedef unsigned int uint; typedef pair PII; typedef pair PLL; const int MAXN = 100000 + 5; const int MAXM = 5000 + 5; int T, N, M; int A[MAXN]; int SUM[MAXN]; bool vis[MAXM]; int main() { #ifndef ONLINE_JUDGE FIN; // FOUT; #endif // ONLINE_JUDGE scanf("%d", &T); while (T--) { scanf("%d %d", &N, &M); bool suc = false; memset(vis, false, sizeof(vis)); vis[0] = true; SUM[0] = 0; for (int i = 1; i <= N; i++) { scanf("%d", &A[i]); if (suc) continue; SUM[i] = (SUM[i - 1] + A[i]) % M; if (vis[SUM[i]]) suc = true; else vis[SUM[i]] = true; } puts(suc ? "YES" : "NO"); } return 0; }