
import java.io.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter bw = new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) throws IOException {
        String ss = br.readLine();
        String[] str = ss.split(" ");
        int n = Integer.parseInt(str[0]);
        int x = Integer.parseInt(str[1]);
        int[] arr = new int[x];
        for (int i=0;i<arr.length;i++){
            arr[i] = i;
        }
        int temp;
        int t;
        int ans = 0;
        boolean[] help = new boolean[400050];
        for (int i=0;i<n;i++){
            ss = br.readLine();
            temp = Integer.parseInt(ss);
            t = temp % x;
            if(arr[t] < n){
                help[arr[t]] = true;
                while(help[ans]) ans++;
                arr[t] += x;
            }
            bw.println(ans);
            bw.flush();
        }
    }
}

		 	 		 	       	 			 				 	 	