import java.util.Scanner;

public class D {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		StringBuilder out = new StringBuilder();
		int q = input.nextInt();
		int x = input.nextInt();
		int[] r = new int[x];
		int ans = 0;
		for(int i=0; i<q; i++) {
			int num = input.nextInt()%x;
			r[num]++;
			while(r[ans%x]>ans/x) {
				ans++;
			}
			out.append(ans+"\n");
		}
		System.out.println(out);
		input.close();
	}

}
