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