q,x=map(int,input().split())
a=[0]*(x+1)
for i in range(x) :
	a[i]=0
mex,base=0,0
ans=""
while q>0:
	q-=1
	val=int(input())
	a[val%x]+=1
	while a[mex] > 0:
		mex+=1
		if mex == x :
			base+=1
			mex=0
			for i in range(x):
				a[i]-=1
	ans+=(str(base*x+mex)+"\n")
print(ans)
