import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
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();
		int[] oc = new int[x];
		
		int counter = 0;
		int o = 0;
		for (int i = 0; i < q; i++) {
			int n = r.nextInt() % x;
			
			oc[n]++;
			
			while (oc[counter] > 0) {
				oc[counter]--;
				counter++;
				o++;
				if (counter > x - 1) {
					counter = 0;
				}
			}
			System.out.println(o);
		}
		
	}

}