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


public class CF_MEX {
	
	private int mex;
	private int x;
	
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            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()); 
        }
    } 
	public static void main(String[] args) {
		FastReader fastIn = new FastReader();
		CF_MEX cf_mex = new CF_MEX();
		int q = fastIn.nextInt();
		cf_mex.x = fastIn.nextInt();
		int[] reminders = new int[cf_mex.x];
		cf_mex.mex = 0;
		boolean[] canBeTransformed = new boolean[q];

		if (cf_mex.x == 1) {
			for (int i = 0; i < q; i++) {
				System.out.println(++cf_mex.mex);
			}
			return;
		}
			
		for (int i = 0; i < q; i++) {
			int number = fastIn.nextInt();
				int j = number % cf_mex.x;
				int index = reminders[j] * cf_mex.x + j;
				if (index < q) {
					canBeTransformed[reminders[j] * cf_mex.x + j] = true;
					reminders[j]++;
				}

			while(cf_mex.mex < q && canBeTransformed[cf_mex.mex]==true) {
				cf_mex.mex++;
			}
			System.out.println(cf_mex.mex);
		}
	}
}
