def main():
    import sys
    q,x=map(int,input().split())
    biglist=[int(sys.stdin.readline()) for b in range(q)]
    s=[0]*x
    m=0
    if x==1:
        for k in range(q):
            print(k+1)
    else:
        for i in range(q):
            c=biglist[i]
            s[c%x]+=1
            while(s[m%x]>0):
                s[m%x]-=1
                m=m+1
            sys.stdout.write("\n"+str(m))
main()