q,x=map(int,input().split())
mark=[0]*(x)
ans=0
a=[]
for _ in range(q):
    n=int(input())
    mark[n%x]+=1
    while mark[ans%x]>0:
        mark[ans%x]-=1
        ans+=1
    a.append(ans)
print('\n'.join(map(str,a)))