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

public class Problem_D {
	public static void main(String[] args) {
		InputReader in = new InputReader();
		StringBuilder out = new StringBuilder();

		int Q = in.nextInt();
		int x = in.nextInt();
		int[] A = new int[Q];
		for (int i = 0; i < Q; i++) {
			A[i] = in.nextInt() % x;
		}
		int[] B = new int[x];
		int mex = 0;
		for (int i = 0; i < Q; i++) {
			B[A[i]]++;
			while (B[mex % x] > mex / x) {
				mex++;
			}
			out.append(mex).append('\n');
		}

		System.out.print(out);
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer st;

		public InputReader() {
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(nextLine());
			}
			return st.nextToken();
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}
