import sys
quernums,x=map(int,input().split( ))
mex=0
remainders=[0 for k in range(x)]
for b in range(quernums):
    if x==1:
        sys.stdout.write(str(b+1))
    else:
        query=int(sys.stdin.readline())
        remainders[query%x]+=1
        minimumremainder=min(remainders)
        indexofmin=remainders.index(minimumremainder)
        sys.stdout.write(str(x*minimumremainder+indexofmin))