from collections import Counter
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math

g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")

q, x = gil()
h = list(range(4*int(1e5)+5))
heapify(h)
used = set()
mul = 2*(math.ceil(int(1e9)/x) + 1)
for _ in range(q):
	y, = gil()
	y = y%x
	l, r = 0, mul
	fnum = None
	while l <= r:
		mid = (l+r)//2
		num = mid*x + y
		if num in used:
			l = mid + 1
		else:
			r = mid - 1
			fnum = num
	used.add(fnum)
	while h[0] in used:
		heappop(h)
	print(h[0])
