import math
from functools import reduce
 
n, x = map(int, input().split(' '))
ans = []
now = [0] * x
m = 0
for _ in range(n):
    y = int(input())
    now[y % x] += 1
    while now[m % x] != 0:
        now[m % x] -= 1
        m += 1
    ans.append(m)
print(*ans, sep=' ', end='\n')


# 
