#####################################   
import atexit, io, sys, collections, math, heapq, fractions
buffer = io.BytesIO() 
sys.stdout = buffer
@atexit.register 
def write(): sys.__stdout__.write(buffer.getvalue())   
####################################
n,x = map(int,raw_input().split())
h = collections.Counter()
mex = 0
for _ in range(n):
	t = int(raw_input())
	t %= x
	h[t] +=1
	while(True):
		if (h[mex % x]) > mex/x:
			mex +=1
		else:
			break

	print mex