"""609C"""
# import math
# import sys
def  main():
	q ,x = map(int,input().split())
	a = [ 0 ]*x
	rem = 0
	A = []
	for _ in range(q):
		# y = int(input())
		a[int(input())%x]+=1
		while a[rem%x]!=0:
			a[rem%x]-=1
			rem+=1
		A.append(rem)
	print('\n'.join(map(str,A)))
		
	return

main()
# def test():
# 	t= int(input())
# 	while t:
# 		main()
# 		t-=1
# test()