from sys import stdin
query,x=map(int,stdin.readline().split())
l=[0]*x;ans=0
for _ in range(query):
    a=int(stdin.readline())
    l[a%x]+=1
    while(l[ans%x]!=0):
        l[ans%x]-=1
        ans+=1
    print(ans)