def build(v, l, r):
    if l == r:
        do[v] = l
    else:
        m = (l + r) // 2
        build(2 * v, l, m)
        build(2 * v + 1, m + 1, r)
        do[v] = min(do[2 * v + 1], do[2 * v])


def update(v, l, r, value):
    if l==r:
        do[v]=1e9
    else:
        m=(l+r)//2
        if value<=m:
            update(2*v,l,m,value)

        else:
            update(2*v+1,m+1,r,value)
        do[v] = min(do[2 * v + 1], do[2 * v])
import sys
q,x=map(int,input().split())
mods=[-1]*x
do=[0]*4*q
build(1,0,q)
g=sys.stdin.readlines()
for i in range(q):
    y=int(g[i].replace("\n",""))
    mods[y%x]+=1
    update(1,0,q,mods[y%x]*x+y%x)
    print(do[1])


