import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {
	static class Reader {
		BufferedReader br;
		StringTokenizer st;

		public Reader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		Reader r = new Reader();

		int q = r.nextInt();
		int x = r.nextInt();

		if (x == 1) {
			for (int i = 1; i < q + 1; i++) {
				System.out.println(i);
			}
		} else {
			int[] oc = new int[x];
//			HashMap<Integer, Integer> oc = new HashMap<Integer, Integer>();
			//			ArrayList<Integer> list = new ArrayList<Integer>();
			for (int i = 0; i < q; i++) {
				int n = r.nextInt();
				int nn = n % x;
				
				oc[nn]++;
				
				int mino = Integer.MAX_VALUE;
				int j = 0;
				for (; j < x; j++) {
					if (oc[j] < mino) {
						if (oc[j] == 0) {
							break;
						}
						mino = oc[j];
					}
				}
				
				if (j == 0) {
					System.out.println(0);
				} else {
					int o = mino * j;
					
					int k = 0;
					for (; k < x; k++) {
						if (oc[k] <= mino) {
							break;
						}
					}
					System.out.println(o + k);
				}
				
//				if (oc.get(nn) == null) {
//					oc.put(nn, 1);
//				} else {
//					oc.put(nn, oc.get(nn) + 1);
//				}

//				int mino = oc.get(0);
//				int count = 0;
//				while (oc.get(count) > 0) {
//					mino = Integer.min(mino, oc.get(count));
//					count++;
//					if (count > x) {
//						break;
//					}
//				}
				
//				System.out.println(mino * count);
			}
		}
	}

}