from sys import stdin,stdout
from math import gcd,sqrt
from collections import deque
input=stdin.readline
R=lambda:map(int,input().split())
I=lambda:int(input())
S=lambda:input().rstrip('\n')
L=lambda:list(R())
P=lambda x:stdout.write(x)
lcm=lambda x,y:(x*y)//gcd(x,y)
hg=lambda x,y:((y+x-1)//x)*x
pw=lambda x:0 if x==1 else 1+pw(x//2)
chk=lambda x:chk(x//2) if not x%2 else True if x==1 else False
sm=lambda x:(x**2+x)//2
N=10**9+7
n,k=R()
a=[0]*k
ln=1
ind=0
mx=0
for i in range(n):
	x=I()
	a[x%k]+=1
	while a[ind]>=ln:
		ind+=1
		mx+=1
		if ind==k:ind=0;ln+=1
	print(mx)