/* ID: 1292871202 LANG: C++ */ #pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int INF = 0x3f3f3f3f; const int MAX = 0x7fffffff; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const ll LMAX = 0x7fffffffffffffffLL; const double eps = 1e-9; const double pi=acos(-1.0); const int maxn = 100000+5; const int maxm = 100000+5; const int mod = 1e9+7; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 int a[maxn]; bool vis[5000+5]; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); //cin.sync_with_stdio(false); //cout.sync_with_stdio(false); int t; cin>>t; while(t--) { int n,m; cin>>n>>m; for(int i=1;i<=n;++i) { scanf("%d",&a[i]); } memset(vis,0,sizeof vis); vis[0]=1; bool ok = false; for(int i=1;i<=n;++i) { a[i] += a[i-1]; int tem = a[i]%m; if(vis[tem]) { ok=true; break; } else vis[tem]=true; } if(ok) cout<<"YES"<