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

public class MEX {
	
	public static void main (String [] args) throws Exception {
	    BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
	    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	    StringTokenizer st = new StringTokenizer(f.readLine());
	    int q = Integer.parseInt(st.nextToken());
	    int x = Integer.parseInt(st.nextToken());
	    
	    TreeSet<Long> notContained = new TreeSet<Long>();
	    HashSet<Long> added = new HashSet<Long>();
	    Map<Integer, Long> remainder = new HashMap<>();
	    notContained.add(0l);
	    
	    while(q --> 0) {
	    	int N = Integer.parseInt(f.readLine()) % x;
	    	long M;
	    	if(remainder.containsKey(N))
	    		M = remainder.get(N) + x;
	    	else
	    		M = N;
	    	remainder.put(N, M);
	    	if(notContained.contains(M)) {
	    		notContained.remove(M);
	    	}
	    	if(!added.contains(M+1)) {
    			notContained.add(M+1);
    		}
	    	added.add(M);
	    	out.println(notContained.first());
	    	//System.out.println(remainder + " " + added + " " + notContained);
	    }
	    
	    out.close();
	    f.close();
	}
	
}