#include #include #include #include #include using namespace std; const int mx=100006; int a,sum; int vs[mx]; int main() { int t,flag; scanf("%d",&t); while (t--) { flag=0,sum=0; int n,m; scanf("%d%d",&n,&m); memset(vs,0,sizeof(vs)); for (int i=0;i