import java.io.*;
import java.util.*;


public class Main 
{
	public static void main(String[] args) 
	{
		JScanner in = new JScanner();
		StringBuilder out = new StringBuilder();

		int q = in.nextInt();
		int x = in.nextInt();
		
		int[] y = new int[q+1];
		int[] mod = new int[x];
		
		for(int i=1; i<=q; i++)
		{
			y[i] = in.nextInt();
			
		}
		
		int mex = 0;
		for(int i=1; i<=q; i++)
		{
			mod[y[i]%x] ++;
			while(mod[mex%x] > mex/x) // mex%x -> 0또는 1또는.. x-1 / mex/x는 0또는 1또는 2... 
				mex ++;
			out.append(mex + "\n");
		}
		

		System.out.println(out);

	}




	//Scanner
	static class JScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		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;
		}
	}
}