from sys import stdin, stdout
q, x = map(int, stdin.readline().split())
cnt = [0 for i in range(x + 1)]
cur = 0
for i in range(q):
    y = int(stdin.readline())
    cnt[y % x] += 1 
    while cnt[cur % x] > 0:
        cnt[cur % x] -= 1
        cur += 1
    print(cur)