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