import sys
input = sys.stdin.readline
q,x=map(int,input().split())
s=[0]*x
m=0
for i in range(q):
    c=int(input())
    s[c%x]+=1
    while(s[m%x]>0):
        s[m%x]-=1
        m=m+1
        #print("Program on")
    print(m)
