from sys import stdin, stdout

q, x = map(int, stdin.readline().split())
modx = [0]*x
ans = 0

for i in range(q):
    item = int(stdin.readline())
    modx[item % x] += 1
    while modx[ans % x] > 0:
        modx[ans % x] -= 1
        ans += 1
    stdout.write("{}\n".format(ans))