import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')
from heapq import heappush,heappop
q,x = map(int,raw_input().split(" "))
pq = []
lazy = [0]*x
for i in range(x):
	heappush(pq,(0,i))
for _ in range(q):
	a = int(input())
	lazy[a%x] += 1

	while lazy[pq[0][1]]!= 0:
		# print _,pq[0]
		v,p = heappop(pq)
		heappush(pq,(v+lazy[p],p))
		lazy[p] = 0
	print pq[0][0]*x+pq[0][1]