//package CF;

import java.io.*;
import java.util.*;

public class Test {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
	}

}
