can someone help me to debug the code getting WA on task 1,2,3,6,7,9?
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("op.txt","w",stdout);
#endif
int t;
cin>>t;
for(int ii=0;ii<t;ii++){
int n,k;
cin>>n>>k;
vector<int> lists(n);
int div=0,ndiv=0;
vector<int> cop(n);
for(int i=0;i<n;i++){
cin>>lists[i];
cop[i]=(lists[i]%k);
if((lists[i]%k)==0) div++;
else ndiv++;
}
if(div==n) cout<<"YES\n";
else{
int found=0;
sort(cop.begin(),cop.end());
for(int i=0;i<n;i++){
if(lists[i]%k!=0) {
int req=(k-(lists[i]%k))%k;
int ind=lower_bound(cop.begin(),cop.end(),req)-cop.begin();
if(cop[ind]!=req) { cout<<"NO\n"; found=1; break; }
}
}
if(!found) cout<<"YES\n";
}
}
return 0;
}