import sys
input = sys.stdin.readline
q,x = [int(i) for i in input().split()]
dick = [0 for i in range(10**6)]
first_positive = 0
for _ in range(q):
    qi = int(input())
    dick[qi%x]+=1
    while(True):
        if(dick[first_positive%x]>0):
            dick[first_positive%x]-=1
            first_positive+=1
        else:
            break
    print(first_positive)