import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;


public class Main
{
	static String s;
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw= new BufferedWriter(new OutputStreamWriter(System.out));
		String str[]= br.readLine().split(" ");
		
		int q = Integer.parseInt(str[0]);
		int x = Integer.parseInt(str[1]);
		int mex = 0;
		int n[] = new int[x];
		int nn=1;
		int m=0;
		for(int h=0; h<q; h++)
		{
			n[Integer.parseInt(br.readLine())%x]++; 
					
			while(true)
			{
				if(m==x)
				{
					m=0;
					nn++;
				}
					
				if(n[m]>=nn)
				{
					mex++;
					m++;
				}
				else
					break;
			}
			System.out.println(mex);
		}
		
	}
}
