// No sorceries shall prevail. //           
import java.util.*;
import java.io.*;
	
public class InVoker {	
	
	static long mod = 1000000007;
	public static void main(String args[]) {
			
		Scanner inp=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		int q=inp.nextInt();
		int x=inp.nextInt();
		int xi[]=new int[x];
		int mex=0;
		while(q-->0) {
			int z=inp.nextInt()%x;
			xi[z]++;
			while(xi[mex%x]>0) {
				xi[mex%x]--;
				mex++;
			}
			out.println(mex);
		}
	
		out.close();
		inp.close();
	}
}
