from sys import stdin,stdout
q,x=map(int,stdin.readline().split())
a=[0]*x
mex=0
for i in range(q):
    e=int(stdin.readline())
    a[e%x]+=1
    while (a[mex%x]>=(mex//x+1)):
        mex+=1
    print(mex)






