q,x=map(int,input().split(" "))
d=[0]*x
mex=0
ans=[]
for i in range(q):
    a=(int(input()))
    d[a%x]+=1
    while d[mex%x]>0:
        d[mex%x]-=1
        mex+=1
    ans.append(mex)
print(*ans,end="\n")


# 
