ls = list(map(int, input().split()))
arri = []
x = ls[1]
nls = [0] * x
mexi = 0
for i in range(ls[0]):
    nls[int(input()) % x] += 1
    while nls[mexi % x]:
        nls[mexi % x] -= 1
        mexi += 1
    arri.append(mexi)
print('\n'.join(map(str, arri)))
    