import sys
q,x=map(int,input().split())
cnt=[0]*(x)
e=0
for i in range(q):
    if x==1:
        print(i+1)
    else:    
        a=int(sys.stdin.readline())
        cnt[a%x]+=1
        while cnt[e%x]:
            cnt[e%x]-=1
            e+=1
        sys.stdout.write(str(e)+"\n")            
    