import java.util.*;
import java.io.*;
public class MEX {
	public static void main (String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
		
		
		int stinky[] = new int[x];
		int stinky2[] = new int[x];
		int last = 0;
		for (int i = 0; i < n; ++i) {
			int temp = sc.nextInt();
			++stinky[temp % x];
			++stinky2[i % x];
			
			
			int xd = -1;
			for (int j = 0; j < x; ++j) {
				if (stinky[j] - stinky2[j] < 0) {
					xd = j;
					break;
				}
			}
			
			if (xd == -1) {
				last = i + 1;
				out.write((i + 1) + "\n");
			}
			else {
				out.write((last + xd) + "\n");
			}
			//System.out.println(Arrays.toString(stinky));
		}
		out.flush();
	}
}
