import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class D1294 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        process(n, x, a);

    }

    private static void process(int n, int x, int[] a) {
        PrintWriter writer = new PrintWriter(System.out);
//        if (x == 1) {
//            for (int i = 1; i <= n; i++) {
//                writer.println(i);
//            }
//            writer.flush();
//            return;
//        }
        int mex = 0;
        int[] ms = new int[n + 1];
        Arrays.fill(ms, -1);
        for (int i = 0; i < n; i++) {
            if (Math.abs(mex - a[i]) % x == 0) {
                mex++;
                for (int j = mex; j <= i; j++) {
                    if (ms[j] != -1) {
                        mex++;
                    } else
                        break;
                }
            } else {
                int possibleFutureMex;
                if (a[i] < mex) {
                    possibleFutureMex = a[i] + x * ((mex - a[i] + x - 1) / x);
                } else {
                    int notNegative = a[i] / x;
                    possibleFutureMex = a[i] - Math.min(notNegative, x * ((a[i] - mex + x - 1) / x));
                }
                while (possibleFutureMex <= n && ms[possibleFutureMex] != -1) {
                    possibleFutureMex += x;
                }
                if (possibleFutureMex <= n) ms[possibleFutureMex] = i;
            }
            writer.println(mex);
            writer.flush();
//            System.out.println(Arrays.toString(ms));
        }
    }
}
