import sys
from collections import defaultdict, deque

inp = sys.stdin.readline
ans = ""

mex = 0

q, x = map(int, inp().split())

arr = [0]*q+[0]
dic = {i: deque([i]) for i in range(x)}

for i in dic:
	while dic[i][-1] + x < q+1:
		dic[i].append(dic[i][-1] + x)

# print(dic, arr)
for _ in range(q):
	n = int(inp())
	ind = dic[n%x].popleft() if dic[n%x] else n%x
	arr[ind] = 1
	while arr[mex] == 1:
		mex += 1

	ans += str(mex) + "\n"
print(ans)