import sys
import math
from collections import defaultdict,Counter

input=sys.stdin.readline
def print(x):
    sys.stdout.write(str(x)+"\n")

# sys.stdout=open("CP3/output.txt",'w')
# sys.stdin=open("CP3/input.txt",'r')

# m=pow(10,9)+7
st=set(range(4*10**5,-1,-1))
q,x=map(int,input().split())
v={}
p=0
for i in range(q):
    y=int(input())
    # if y in v:
    #     y+=v[y]*x
    #     v[y]+=1
    #     if y<=4*10**5:
    #         st.remove(y)
    # else:
    d=y//x
    y-=d*x
    if 0<=y<=4*10**5:
        if y not in v:
            v[y]=1
        else:
            y1=y
            y+=v[y]*x
            v[y1]+=1
            # if y<=4*10**5:
        st.discard(y)
    while p not in st:
        p+=1
    print(p)
