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