from sys import stdin,stdout
t = 1
#t=int(input())
for i in range(t):
	#solve
	q,x=map(int,stdin.readline().split())
	mul=[0]*x
	ANS=0
	ans=[False]*500000
	for i in range(q):
		y=int(stdin.readline())
		m=y%x
		if (mul[m]*x+m)<500000:
			ans[mul[m]*x+m]=True
			mul[m]+=1
		while ans[ANS]:
			ANS+=1
		stdout.write(str(ANS)+"\n")
