'use strict'

const qx = readline().split(' ');
let q = +qx[0];
const x = +qx[1];

const problem = (n) => {
    for (let i = 2; i < Math.cbrt(n); i++) {
        if (n % i === 0) {
            n /= i;
            for (let j = i + 1; j < Math.sqrt(n); j++) {
                if (n % j === 0) return `YES\n${i} ${j} ${n/j}`;
            }
        }
    }
    return 'NO';
}
const r = Array(x).fill(0);
let j = 0;

while(q--) {
    r[+readline() % x]++;
    while(r[j % x]) { r[j % x]--; j++; }
    print(j);
}
