q,x=map(int,input().split())
mod=[0]*x
ans=0
ans_array=[]
for i in range(q):
	mod[int(input())%x]+=1
	while mod[ans%x]:
		mod[ans%x]-=1
		ans+=1
	ans_array.append(ans)
print('\n'.join(map(str,ans_array)))