import sys

q,x = list(map(int,sys.stdin.readline().rstrip().split(' ')))

punt = 0
m = [0]*x
for i in range(q):
    y = int(sys.stdin.readline().rstrip())
    m[y%x] += 1
    while m[punt%x] > 0:
        m[punt%x] -=1
        punt += 1
    print(punt)