import sys
input=sys.stdin.readline
q,x=map(int,(input()).split())
mex=0
a=[0 for i in range(x)]
for i in range(q):
    y=int(input())
    a[y%x]+=1
    while a[mex%x]>0:
        a[mex%x]-=1
        mex+=1
    print(mex)