import sys
input = sys.stdin.readline

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