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 ours[] = new int[x];
		int index = 0;
		for (int i = 0; i < n; ++i) {
			int temp = sc.nextInt();
			//System.out.println(temp);
			++ours[temp % x];
			while (ours[index % x] > 0) {
				--ours[index % x];
				++index;
			}
			//System.out.println("index: " + index);
			out.write((index) + "\n");
//			++actual[i % x];
//			
//			System.out.println(Arrays.toString(ours));
//			System.out.println(Arrays.toString(actual));
//			int xd = -1;
//			for (int j = 0; j < x; ++j) {
//				if (ours[j] - actual[j] < 0) {
//					xd = j;
//					break;
//				}
//			}
//			
//			if (xd == -1) {
//				last = i + 1;
//				System.out.println(i + 1);
//				//out.write((i + 1) + "\n");
//			}
//			else {
//				System.out.println(last + xd);
//				//out.write((last + xd) + "\n");
//			}
		}
		out.flush();
	}
}
