import sys
input = sys.stdin.readline
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(input())
        s[c%x]+=1
        while(s[m%x]>0):
            s[m%x]-=1
            m=m+1
        sys.stdout.write(str(m))