q,x=map(int,input().split())
sachin=[]
count1=0
count2=0
index=0
arr=[]
for i in range(x):
	arr.append(0)
out=[]
for i in range(q):
	val=int(input())
	arr[val%x]+=1
	while arr[index]>count1:
		count2+=1
		index+=1
		if index==x:
			count1+=1
		index%=x
	out.append(count2)
print('\n'.join(map(str,out)))
