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