import sys
# sys.stdout=open("output.out","w")
input = sys.stdin.readline

q, x = map(int,input().split())
k = [0 for _ in range(x)]
m = 0
for i in range(q):
	g = int(input())
	k[g%x] += 1
	while k[m%x]>0 :
		k[m%x] -= 1
		m += 1
	print(m)