from array import array
q,x = tuple(map(int,input().split()))
count = array( 'i' ,[0]*x)
arr = [ int(input())%x for _ in range(q)]
mex=0
mexs = []
for p in arr:
    count[p]+=1
    while count[mex%x] > 0:
        count[mex%x]-=1
        mex+=1
    mexs.append(str(mex))
print( "\n".join(mexs) )