q,x=map(int,input().split())
r=[0]*x  #list of occurences of mods (not used yet)
ans=0  #the solution to be printed
for _ in range(q):
    y=int(input())
    r[y%x]+=1
    while r[ans%x]:
        r[ans%x]-=1
        print(r)
        ans+=1
    print(ans)
    