from sys import stdin
Q, X = map(int, stdin.readline().strip('\r\n').split())

A = [0] * X
mex = 0
ans = []
for line in stdin:
    q = int(line)
    q %= X
    A[q] += 1
    while A[mex % X] > mex // X:
        mex += 1
    ans.append(str(mex))

print "\n".join(ans)

