#include<bits/stdc++.h>
#include<map>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,m;
		cin>>n>>m;
		bool b=false;
		
		map<int,int> mp;
		
		int count=0;
		
		for(int i=0 ;i<n; i++)
		{
			int num;
			cin>>num;
			
            if(num%m==0) b=true;
			else mp[num%m]++;
		}
		
		map<int,int>::iterator it,itr;

		if(b) count++;
		
			
		  for(it = mp.begin(); it!= mp.end() ;it++)
		  {
		  	
		    if(it->second > 0)
		    {
		   	  int k = m-it->first;
		   	  itr = mp.find(k);
		   	
		   	 if(itr!= mp.end() && itr->second > 0)
		   	  {
		   	      int j = min (it->second , itr->second) +1;
				  it->second -=j;
				  itr->second -=j;
				  count++; 	
			  }
		    } 	   
		  }
	    
		for(it = mp.begin(); it!=mp.end() ; it++)
		{
			if(it->second > 0)
				count+= it->second;
			
		}
		
		cout<<count<<endl;
	}
	
	return 0;
}
