from math import *
from sys import *
q,x=map(int,stdin.readline().split())
m = [0] * (x)
ar = [0] * (q+1)
y=0
for o in range(q):
    n=int(stdin.readline())
    mod=n%x
    c=m[mod]*x+mod
    m[mod]+=1
    if c<=q:
        ar[c]+=1
    for i in range(y,q+1):
        if ar[i]==0:
            print(i)
            y=i
            break
