from collections import *

q, x = map(int, input().split())
mem, mi, ans = [0] * x, 0, []

for i in range(q):
    n = int(input())
    mem[n % x] += 1

    while mem[mi % x]:
        mem[mi % x] -= 1
        mi += 1
    ans.append(str(mi))

print('\n'.join(ans))
