q, x = [int(i) for i in input().split(' ')]
cc = [0] * x
mex = 0
res = []
for _ in range(q):
	y = int(input())
	y = y % x
	cc[y] += 1
	while cc[mex % x] > 0:
		cc[mex % x] -= 1
		mex += 1
	res.append(str(mex))
print('\n'.join(res))