import sys
input=sys.stdin.readline
import collections
from collections import defaultdict
def mex_(arr,mex):
    i=mex
    while arr[i]==1:
        i+=1
    return(i)
q,x=map(int,input().split())
freq=defaultdict(int)
l=[0]*(400000+1)
mex=0
for i in range(q):
    pq=int(input())
    freq[pq%x]+=1
    sub=abs(mex-pq)
    if sub%x==0:
        l[mex]=1
        mex=mex_(l,mex)
    else:
        try:
            f=freq[pq%x]
            l[pq%x+(f-1)*x]=1
        except:
            pass
    print(mex)
