#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 1000000; int n, m; bool vis[N]; int a[N]; int main() { int T; scanf("%d", &T); while (T--) { scanf("%d%d", &n, &m); for (int i = 0; i < m; i++) vis[i] = 0; vis[0] = 1; for (int i = 1; i <= n; i++) scanf("%d", &a[i]); bool ok = 0; for (int i = 1; i <= n; i++) { a[i] = (a[i] + a[i - 1]) % m; if (vis[a[i]]) ok = 1; vis[a[i]] = 1; } puts(ok ? "YES" : "NO"); } }