A. XXXXX
#include<bits/stdc++.h> using namespace std; typedef long long ll; int a[100000]; int main() { int t; cin>>t; while(t--) { int n,x; int sum = 0; cin>>n>>x; int l = -1; int r; for(int i=1;i<=n;i++) { int b; cin>>b; if(b%x) { if(l==-1) l = i; r = i; } sum+=b; } if(sum%x) { cout<<n<<endl; } else if(l==-1) { cout<<-1<<endl; } else { cout<<n-min(n-r+1,l)<<endl; } } }