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

public class p1294D {

	public void realMain() throws Exception {

		BufferedReader fin = new BufferedReader(new InputStreamReader(System.in), 1000000);

		String in = fin.readLine();

		String[] ar = in.split(" ");

		int q = Integer.parseInt(ar[0]);
		int x = Integer.parseInt(ar[1]);
		
		int[] cnt = new int[x];
		int pointer = 0;

		StringBuilder sb = new StringBuilder("");

		for(int i = 0; i < q; i++) {
			int ret = 0;
			boolean dig = false;
			for (int ch = 0; (ch = fin.read()) != -1; ) {
        			if (ch >= '0' && ch <= '9') {
            				dig = true;
           				ret = ret * 10 + ch - '0';
        			} else if (dig) break;
    			}

			cnt[ret % x]++;

			int nextpointer = (pointer+1) % x;

			if(cnt[pointer] > cnt[nextpointer]) {
				pointer = nextpointer;
			} else if(cnt[pointer] == cnt[nextpointer] && nextpointer == 0) {
				pointer = nextpointer;
			}

			sb.append(cnt[pointer] * x + pointer);
			sb.append('\n');
			
		}

		System.out.println(sb);



	}


	public static void main(String[] args) throws Exception {
		p1294D a = new p1294D();
		a.realMain();
	}
}