import java.io.PrintWriter;
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) {
        try (PrintWriter writer = new PrintWriter(System.out)) {
            int[] module_x = new int[x];
            int mex = 0;
            for (int i = 0; i < n; i++) {
                module_x[a[i] % x]++;
                for (int j = mex; j <= n; j++) {
                    if (module_x[mex % x] > 0) {
                        module_x[mex % x]--;
                        mex++;
                    } else break;
                }
                writer.println(mex);
            }
            writer.flush();
        }
    }
}
