import java.io.*;
import java.util.*;
import java.lang.*;
public class Codechef {
	PrintWriter out;
    StringTokenizer st;
    BufferedReader br;
 	
 	class Pair implements Comparable<Pair>
	{
	    int x;
	    int y;
 
	    Pair(int t, int r) {
	       x = t;
	       y = r;
	    }
	    public int compareTo(Pair p)
	    {
	    	return this.x-p.x;
	    }
 	}
 
	String ns() {
        while (st == null || !st.hasMoreElements()) {
 
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    String nextLine() throws Exception {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            throw new Exception(e.toString());
        }
        return str;
    }
 
    int nextInt() {
        return Integer.parseInt(ns());
    }
 
    long nextLong() {
        return Long.parseLong(ns());
    }
 
    double nextDouble() {
        return Double.parseDouble(ns());
    }
	
	
	public static void main(String args[]) throws IOException {
		new Codechef().run();
	}
 
	void run() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
		solve();
		out.flush();
		out.close();
	}
 
	void solve() throws IOException{
		int q=nextInt();
		int x=nextInt();
		TreeSet<Integer> set = new TreeSet<>();
		int a[]=new int[x];
		Arrays.fill(a,-1);

		for(int i=0;i<500000;i++)
			set.add(i);

		while(q-->0)
		{
			int m=nextInt();
			int r=m%x;
			a[r]++;

			if(r+a[r]*x<500000)
				set.remove(r+a[r]*x);
			out.println(set.first());
		
		}

	
 
	}
}