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:
		l, r = 0, 10**9 + 100
		ans = 10**9 + 100
		while l <= r:
			i = (l + r)//2
			curr = n - i*x
			if curr >= mex:
				ans = min(ans, curr)
				l = i+1
			else:
				r = i-1
		n = ans
	arr.add(n)
	while mex in arr:
		mex += 1
	print(mex)