import sys
input = sys.stdin.readline
q,x = [int(i) for i in input().split()]
dick = {}
first_positive = 0
for _ in range(q):
    qi = int(input())
    c,d = qi%x,first_positive%x
    if(c==d):
        first_positive+=1
        for i in range(10**4):
            d = first_positive%x
            if(d not in dick):
                break
            else:
                dick[d]-=1
                if(dick[d]==0):
                    del dick[d]
                first_positive+=1
    else:
        if(c not in dick):
            dick[c]=0
        dick[c]+=1
    print(first_positive)