# import sys
# file = open('test1')
# sys.stdin = file

def ii():
	a = int(input())
	return a
def ai():
	a = list(map(int, input().split()))
	return a
def mi():
	a = map(int, input().split())
	return a



q,x = mi()
mex = 0
freq = [0] * x
ans = []
for i in range(q):
	freq[ii()%x] += 1
	while freq[mex%x]>0:
		freq[mex%x] -= 1
		mex += 1
	ans.append(mex)
print("\n".join(map(str, ans)))