quernums,x=map(int,input().split( ))
mex=list(range(quernums))
mex.reverse()
array0=[]
for b in range(quernums):
    query=int(input())
    array0.append(query)
    cv0=0
    if query in mex:
        mex.remove(query)
    changesmade=False
    while cv0<=len(array0)-1 and not(changesmade):
        if (array0[cv0]-mex[-1])%x==0 and array0[cv0]>mex[-1]:
            array0[cv0]=mex[-1]
            changesmade=True
            mex.pop(-1)
        elif (array0[cv0]-mex[-1])%x==0 and (cv0<=len(array0)-2 and array0[cv0]==array0[cv0+1]):
            array0[cv0]=mex[-1]
            changesmade=True
            mex.pop(-1)
        else:
            cv0+=1
    print(mex[-1])
array0.sort()
cv=0
while (cv<=(len(array0)-1) and len(mex)>0):
    if (array0[cv]-mex[-1])%x==0 and array0[cv]>mex[-1]:
        array0[cv]=mex[-1]
        cv=0
        array0.sort()
        mex.pop(-1)
    elif (array0[cv]-mex[-1])%x==0 and (cv<=len(array0)-2 and array0[cv]==array0[cv+1]):
        array0[cv]=mex[-1]
        cv=0
        array0.sort()
        mex.pop(-1)
    else:
        cv+=1
if len(mex)==0:
    print(quernums)
else:
    print(mex[-1])