import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class TaskD {
	public static void main(String[] arg) {
		final FastScanner in = new FastScanner(System.in);
		final PrintWriter out = new PrintWriter(System.out);
		final int Q = in.nextInt();
		final int x = in.nextInt();
		int mex = 0;
		int[] arr = new int[x];
		int y=0;
		StringBuilder sb = new StringBuilder();
		for (int q = 0; q < Q; q++) {
			y = in.nextInt();
			arr[y%x]++;
			while (arr[mex % x] > 0) {
				arr[mex % x]--;
				mex++;
			}
			sb.append(mex);
			sb.append("\n");
		
		}
		out.printf("%s",sb.toString());
		out.close();
		in.close();
	}

	private static class MinST {
		final int[][] a;
		final int s;

		public MinST(final int n) {
			int s = 1;
			while (n * 2 > s) {
				s *= 2;
			}
			this.s = s;
			a = new int[s][2];
			for (int i = s / 2; i < s; i++) {
				a[i][0] = 0;
				a[i][1] = i - s / 2;
			}
			for (int i = n; i < s / 2; i++) {
				set(i, Integer.MAX_VALUE);
			}
		}

		public void set(int ind, int val) {
			int pos = pos(ind);
			a[pos][0] = val;
			a[pos][1] = ind;
			updateMin(pos);
		}

		public void print() {
			for (int i = s / 2; i < s; i++) {
				System.out.printf("%d ", a[i][0]);
			}
			System.out.printf("%n");
		}

		public void updateMin(final int pos) {
			int t = (pos) / 2;
			while (t != 0) {
				int p1 = t * 2;
				int p2 = p1 + 1;
				if (a[p1][0] <= a[p2][0]) {
					a[t][0] = a[p1][0];
					a[t][1] = a[p1][1];
				} else {
					a[t][0] = a[p2][0];
					a[t][1] = a[p2][1];
				}
				t /= 2;
			}
		}

		public int get(int ind) {
			return a[pos(ind)][0];
		}

		private int pos(int ind) {
			return s / 2 + ind;
		}

	}

	public static int[] min(int n, int arr[]) {
		int min = arr[0];
		int minIndex = 0;
		for (int i = 1; i < n; i++) {
			if (min > arr[i]) {
				min = arr[i];
				minIndex = i;
			}
		}
		return new int[] { min, minIndex };
	}

	private static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(InputStream stream) {
			try {
				br = new BufferedReader(new InputStreamReader(stream));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		int[] readIntArr(int n) {
			int[] result = new int[n];
			for (int i = 0; i < n; i++) {
				result[i] = Integer.parseInt(next());
			}
			return result;
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		long nextLong() {
			return Long.parseLong(next());
		}

	}

}
