q,x=map(int,input().split())
a=[0]*x 
ans=0
for _ in range(q):
    i=int(input())
    a[i%x]+=1
    temp=ans%x
    while(a[temp]!=0):
        a[temp]-=1
        ans+=1
    print(ans)
    
        
    