
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Round615D {

	public static void solve() {
		int q=s.nextInt();
		int x=s.nextInt();
		int max = (int)4e5+10;
		int[] redundant = new int[max];
		int pointer = 0;
		for(int i=0;i<q;i++) {
			int z  = s.nextInt();
			z -= (z/x)*x;
			int temp_p= pointer-((pointer)/x)*x;
			if(temp_p==z) {
				while(true) {
					pointer++;
					temp_p= pointer-((pointer)/x)*x;
					if(redundant[temp_p]!=0) {
						redundant[temp_p]--;
					}else {
						break;
					}
				}
			}else {
				redundant[z]++;
			}
			out.println(pointer);
		}
	}

	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		s = new FastReader();
		solve();
		out.close();
	}

	public static FastReader s;
	public static PrintWriter out;

	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	
}
