import sys
input=sys.stdin.readline
from collections import defaultdict
t,x=map(int,input().split())
d=defaultdict(int)
w=defaultdict(int)
for i in range(x):
    w[i]=i

i=0
for _ in range(t):
    y=int(input())
    y%=x
    d[w[y]]+=1
    w[y]+=x
    while(d[i]):
        i+=1
    print(i)
