a, b = list(map(int, input().strip().split(" ")))
c = [0] * b
m = 0
ans = []
for i in range(a):
	y = int(input().strip())
	c[y % b] += 1
	while c[m % b] > (m/ b):
		m += 1
	ans.append(m)
print("\n".join(map(str, ans)))