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