import sys

q,x = map(int,sys.stdin.readline().strip().split())

mxN = 4*(10**5)+1

mex = 0
a = {i:0 for i in range(x)}

need_to_mex = 0
mn = 0
needCheck = False
for query in range(q):
    n = int(sys.stdin.readline().strip()) % x    
    a[n] += 1
    if n == need_to_mex:
        if needCheck:
            mn = mxN
            mx = -1
            pos_mn = 0
            for k in a:
                if a[k] < mn:
                    mn = a[k]
                    pos_mn = k        
            need_to_mex = pos_mn
            mex = mn*x + pos_mn
            if (pos_mn > 0 and mn < a[pos_mn-1]) or (pos_mn < x and mn < a[pos_mn+1]):
                needCheck = True
            else:
                needCheck = False
        else:
            mex += 1
            need_to_mex += 1
            if need_to_mex >= x:
                need_to_mex = 0
    else:
        needCheck = True
    print(mex)
        
