from sys import stdin, stdout
q, x = map(int, stdin.readline().split())

mex=0
l=[0]*(x+1)

for i in range(q):
    n=int(stdin.readline())
    l[n%x]+=1

    while(l[mex%x]):
        l[mex%x]-=1
        mex+=1

    print (mex)