from sys import stdin, stdout

fin = lambda: stdin.readline()

fout = lambda args: stdout.write(' '.join(str(i) for i in args) + '\n')

q, x = map(int, fin().split())
cnt = [0] * x
mex = 0
for _ in range(q):
    a = int(fin())
    cnt[a % x] += 1
    while cnt[mex % x]:
        cnt[mex % x] -= 1
        mex += 1
    fout([mex])
