q, x = map(int, input().split())
a = [0]*x
mex = 0
out = []
for i in range(q):
    a[int(input()) % x] += 1
    while a[mex % x]>0:
        a[mex%x] -= 1
        mex += 1
    out.append(mex)
print(*out)