import sys
input=sys.stdin.readline
from collections import defaultdict

def main():
	q,x = [int(s) for s in input().split()]
	a = set()
	d = {}
	ans = 0
	ans1=0
	c = defaultdict(int)
	for i in range(q):
		y = int(input())
		c[y%x]+=1
		while c[ans%x]>0:
			c[ans%x]-=1
			ans= (ans+1)%x
			if ans==0:
				ans1+=1
		print(ans+ans1*x)
		# print()

if __name__ == '__main__':
	main()