import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class MEX_maximizing {

	public static void main(String[] args) {
		Scanner inp = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int q, x, ans = 0;
		q = inp.nextInt();
		x = inp.nextInt();
		int[] a = new int[400005];
		
		while(q-- > 0) {
			int k = inp.nextInt();
			a[k%x]++;
			while (a[ans%x] > ans/x) ans++;
			out.println(ans);
		}
		
		inp.close();
		out.close();
		/*
		Scanner sc= new Scanner(System.in);
		int q = sc.nextInt();
		int x= sc.nextInt();
		int output = 0;
		int[] residues = new int[x];
		while(q-->0)
		{
			int temp = sc.nextInt() % x;
			residues[temp]++;
			while(residues[output%x] > output/x)
			{
				output++;
			}
			System.out.println(output);
		}
		*/
	}

}
