import java.io.*;
import java.util.*;
public class Main {
	static HashMap<Integer,Integer> factors(int n){ 
		HashMap<Integer,Integer> h=new HashMap<>();
		if(n%2==0) {
			h.put(2,0);
		}
        while (n%2==0) 
        { 
        	h.put(2, h.get(2)+1);
            n /= 2; 
        }  
        for (int i = 3; i <= Math.sqrt(n); i+= 2) 
        { 
            if(n%i==0) {
            	h.put(i,0);
            }
            while (n%i == 0) 
            { 
            	h.put(i, h.get(i)+1); 
                n /= i; 
            } 
        } 
        if (n>2) {
        	h.put(n,1); 
        }
        return h;
    } 
	public static void main(String[] args) throws IOException 
	{ 
		FastScanner f = new FastScanner(); 
		int ttt=1;
//		ttt=f.nextInt();
		PrintWriter out=new PrintWriter(System.out);
		for(int tt=0;tt<ttt;tt++) {
			int n=f.nextInt();
			int x=f.nextInt();
			int mex=0;
			int[] l=new int[30000005];
			for(int i=0;i<n;i++) {
				int num=f.nextInt();
				int k=-1;
				if(num<mex) {
					k=(mex-num+x-1)/x;
				}
				else {
					k=(mex-num)/x;
				}
				
				num+=k*x;
				while(num<0) num+=x;
				l[num]++;
				while(l[mex]>0) mex++;
				System.out.println(mex);
			}
		}
		out.close();
	} 
	static void sort(int[] p) {
        ArrayList<Integer> q = new ArrayList<>();
        for (int i: p) q.add( i);
        Collections.sort(q);
        for (int i = 0; i < p.length; i++) p[i] = q.get(i);
    }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}
} 	