import sys
from math import ceil
input = sys.stdin.readline

q, x = map(int, input().split())
mex = 0
arr = set()
for _ in range(q):
	n = int(input())
	if n < mex:
		while n in arr:
			n += x
	else:
		n -= x*int(ceil((n-mex)/x))
	arr.add(n)
	while mex in arr:
		mex += 1
	print(mex)