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

public class MEXmaximizing {

	public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
		int q = in.nextInt();int x = in.nextInt();
		int rems[] = new int[x];
		int ans = 0;
		while(q-->0) {
			int y = in.nextInt();
			rems[y%x]++;
			while(rems[ans%x]>ans/x) ans++;
			out.println(ans);
		}
		out.close();
	}
}






