//package com.company;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Robots {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tok = new StringTokenizer(in.readLine(), " ");

        int q = Integer.parseInt(tok.nextToken());
        int x = Integer.parseInt(tok.nextToken());

        int[] array = new int[q], tmp;
        int[] count = new int[q];
        for (int i = 0; i < q; i++) {
            int y = Integer.parseInt(in.readLine());

            array[i] = y;
            tmp = new int[q];
            System.arraycopy(array, 0, tmp, 0, q);

            int mex = 0;
            boolean flag = true;
            while (flag) {
                count = new int[q];
                Arrays.sort(tmp);
                mex = -1;
                int last = 0;
                for (int j = 0; j < q; j++) {
                    if (tmp[j] > last + 1) {
                        mex = last + 1;
                        break;
                    }
                    last = tmp[j];
                }
                if (mex == -1)
                    mex = tmp[q - 1] + 1;

                for (int j = q-i-1; j < q; j++) {
                    if (tmp[j] < q)
                        count[tmp[j]]++;
                }
                flag = false;
                for (int j = q - i-1; j < q; j++) {
                    if (tmp[j] > mex || count[tmp[j]] > 1) {
                        if ((tmp[j] - mex) % x == 0) {
                            if (tmp[j] < q) {
                                count[tmp[j]]--;
                            }
                            tmp[j] = mex;
                            count[tmp[j]]++;
//                            System.out.println(j + " " + tmp[j]);
                            flag = true;
                            break;
                        }
                    }
                }
            }
            System.out.println(mex);

        }
    }
}
