import java.util.Scanner;

public class D1294 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int Q = in.nextInt();
        int X = in.nextInt();
        int[] stat = new int[X];
        int multiple = 0;
        int reminder = 0;
        StringBuilder output = new StringBuilder();
        for (int q=0; q<Q; q++) {
            int y = in.nextInt()%X;
            stat[y]++;
            if (y == reminder) {
                while (stat[reminder] > multiple) {
                    reminder++;
                    if (reminder == X) {
                        reminder = 0;
                        multiple++;
                    }
                }
            }
            int mex = multiple*X + reminder;
            output.append(mex).append('\n');
        }
        System.out.print(output);
    }

}
