import sys
input = sys.stdin.readline

q,x=map(int,input().split())
LIST=[0]*x
mex=0

for qu in range(q):
    LIST[int(input())%x]+=1

    while LIST[mex%x]>mex//x:
        mex+=1

    print(mex)

        
