from sys import stdin , stdout
from os import path
if path.exists("input.txt"):
	stdin = open("input.txt",'r')


def next(arr,m,l):
	r = l 
	for i in range(m,l):
		if arr[i] == 0 :
			r = i 
			return r
	return r

g , x = map(int,stdin.readline().strip().split())
count = [0]*x
start = 0
minInd = 0 
out = 0 
for _ in range(g):
	j = int(stdin.readline())
	modex = j%x
	count[modex]+=1
	if modex == minInd:
		w= next(count,minInd,x)
		if w < x:
			minInd = w
			out = start + minInd
			stdout.write(str(out)+"\n")
			continue
		else:
			start+=x
			for i in range(x):count[i]-=1
			minInd = next(count,0,x)
			out = start+ minInd 
			stdout.write(str(out)+"\n")
			continue
	else:
		out = start + minInd
		stdout.write(str(out)+"\n")
