def zip_sorted(a,b):

	# sorted  by a
	a,b = zip(*sorted(zip(a,b)))
	# sorted by b
	sorted(zip(a, b), key=lambda x: x[1])

	return a,b

import sys
from collections import  defaultdict
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))
S = lambda : list(map(str,input().split()))


q,x = I()
if x==1:
	for t1 in range(q):
		y,   = I()
		print(t1+1)
else:
	from collections import defaultdict
	mem1 = defaultdict(int)
	dp  = [0]*(q+1)

	min_idx = 0
	for t1 in range(q):
		y,   = I()

		if (y%x) in mem1:

			if mem1[(y%x)]<len(dp):
				dp[mem1[(y%x)]] = 1

				mem1[y%x] = mem1[(y%x)]+x

				min_idx = dp.index(0,min_idx,q+1)

				print(min_idx)

			else:

				print(min_idx)
		else:

			if y<min_idx:

				sum1 = y-((min_idx)%x)

				if (sum1+min_idx)>=len(dp):

					print(min_idx)

					continue

				else:

					dp[min_idx+sum1] = 1
					mem1[y%x] = min_idx+sum1+x

					min_idx = dp.index(0,min_idx,q+1)

					print(min_idx)

			elif y>min_idx:

				sum1 = ((y-min_idx)%x)

				if (sum1+min_idx)>=len(dp):

					print(min_idx)

					continue

				else:

					dp[min_idx+sum1] = 1
					mem1[y%x] = min_idx+sum1+x

					min_idx = dp.index(0,min_idx,q+1)

					print(min_idx)

			else:

				dp[min_idx] = 1

				min_idx = dp.index(0,min_idx,q+1)

				print(min_idx)
