#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define pb push_back

void solve()
{
  int n,m;
  cin>>n>>m;
  vector<int>arr;
  rep(i,0,n)
  {
    int a;
    cin>>a;
    arr.pb(a);
  }
  int cnt=0;
  rep(i,0,n)
  {
    if(arr[i] % m == 0){
      arr[i] = -1;
      cnt = 1;
    }
  }
  
  map<int,int>mp;
  rep(i,0,n)
  {
    if(arr[i] != -1){
      int rem = arr[i] % m;
      mp[rem]++;
    }
  }
  /*
  rep(i,0,n){
    cout << arr[i] << " ";
  }cout <<endl;
  for(auto it:mp)
  {
    cout << it.first << " " << it.second <<endl;
  }
  */
  for(auto it:mp)
  {
    int f = it.first;
    int req = m - f;
    int freq = it.second;
    if(mp.find(req) != mp.end())
    {

      if(f == req){
        cnt++;
      }
      else{
        if(freq == mp[req]){
          cnt++;
        }
        else{
          cnt = cnt + abs(freq - mp[req]);
        }
        // mp.erase(f);
        mp.erase(req);
      }
    }
    else
    {
      cnt += freq;
    }
    
  }
  cout << cnt << endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  cin>>tc;
  while(tc--)
  solve();
  return 0;
}
// 6
// 7 5 13 5