

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


public class Main {
	
	public static void main(String args[]) {
		InputReader obj = new InputReader(System.in);
		int q = obj.nextInt();
		int x = obj.nextInt();
		int k=0;
		StringBuilder str = new StringBuilder();
		int	 chk [] = new int[(int)4e5+1];
		for(int l=0;l<q;l++) {
			int n = obj.nextInt();
			chk[n%x]++;
			while(k<q && chk[k%x]>0) {
				chk[k%x]--;
				k++;
			}
			str.append(k);
			str.append("\n");
		}
		System.out.println(str);
	}
	
	public static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;
	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream), 32768);
	        tokenizer = null;
	    }
 
	    public String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }
 
	    public int nextInt() {
	        return Integer.parseInt(next());
	    }
 
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    
 
	}

}
