#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int q,x;
	cin>>q>>x;
	vector<int > a;
	int f[x]={0};
	for (int i=0;i<q;i++)
	{
		int y;
		cin>>y;
		a.push_back(y);
		
		 f[y%x]++;
		int m,n;
		m=(i)/x;
		n=(i)-m*x;
		int yl;
		  if(i==0) yl=0;
		  else if(f[n]<f[yl]) yl=n;
		
		
			cout<<x*f[yl]+yl<<endl;
			
			 
		   	   	  	  
			 
		   }
	
		
	
}
