from sys import stdin
def solve():
    q,x=map(int,stdin.readline().split())
    d={}
    mx,mex=0,0
    for _ in range(q):
        mx+=1
        n=int(stdin.readline())
        d.setdefault(n%x,0)
        d[n%x]+=1
        while(mex<mx):
            if mex%x in d and d[mex%x]>=1:
                d[mex%x]-=1
                mex+=1
            else:
                break
        print(mex)
        
solve()
