import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.StringTokenizer;
import java.util.TreeMap;

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];

		for (int q = 0; q < Q; q++) {
			final int y = in.nextInt();
			arr[y % x]++;
			int[] res = min(Math.min(q, x), arr);
			out.printf("%d%n", res[0] * x + res[1]);
		}
		out.close();
		in.close();
	}

	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());
		}

	}

}
