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) {
        // a b c
        int mex = 0;
        boolean[] used = new boolean[n];
        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) {
                used[i] = true;
                if (ms[mex] != -1) {
                    int j = 0;
                }
                ms[mex] = i;
                mex++;
                for (int j = mex; j < n + 1; j++) {
                    if (ms[j] != -1) {
                        used[ms[j]] = true;
                        mex++;
                    } else break;
                }
            } else {
                int possibleFutureMex = Math.abs(mex - a[i]) > x ? Math.abs(mex - a[i]) / x + x : a[i];
                while (possibleFutureMex <= n && ms[possibleFutureMex] != -1){
                    possibleFutureMex += x;
                }
                if (possibleFutureMex <= n) ms[possibleFutureMex] = i;
            }
            System.out.println(mex);
//            System.out.println(Arrays.toString(ms));
        }
    }

    private static int recalc(int n, int[] a, int x, boolean[] used, int i, int mex, int[] ms) {
        for (int j = 0; j <= i; j++) {
            if (used[j]) continue;
            if (ms[j] == mex) {
                used[j] = true;
                mex++;
            } else if (ms[j] < mex) {
                if ((mex - ms[j]) % x == 0) {
                    used[j] = true;
                    mex++;
                } else {
                    ms[i] += (mex - ms[j]) / x + x;
                }
            }

        }
        return mex;
    }
}
