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;
		Map<Integer, Integer> map = new HashMap<>();
		for (int q = 0; q < Q; q++) {
			int y = in.nextInt();
			if (y > mex && (y - x) > 0) {
				y=mex+(y-mex)%x;
			}
			if(y + x < mex) {
				y = mex - (mex-y)%x;
			}
			Integer val = map.getOrDefault(y, 0);
			map.put(y, val + 1);
			// re-balance
			//System.out.println(map);

			boolean changed = true;
			while (changed) {
				changed = false;
				if (map.containsKey(mex)) {
					mex++;
					changed = true;
				}

				val = map.get(mex - x);
				if (val != null && val > 1) {
					map.put(mex - x, 1);
					map.put(mex, val - 1);
					mex++;
					changed = true;
				}

				val = map.get(mex + x);
				if (val != null && val > 0) {
					map.put(mex, 1);
					map.put(mex + x, val - 1);
					mex++;
					changed = true;
				}
			}

			out.printf("%d%n", mex);
		}
		Solution solution = new Solution();
		out.close();
		in.close();
	}

	private static class Solution {

	}

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

	}

}
