import math as mt 
import sys,string
input=sys.stdin.readline
from collections import defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
q,x=M()
l=[]
for i in range(x):
    l.append(i)

d=defaultdict(int)
ind=0
for i in range(q):
    w=I()
    w%=x
    d[l[w]]+=1
    l[w]+=x
    while(d[ind]):
        ind+=1
    print(ind)
    
    
