from sys import stdin, stdout

def main():
    q, x = map(int, stdin.readline().split())
    
    mex = 0
    m = [0] * x
    i = 0
    for j in range(q):
        el = int(stdin.readline())
        # el - x; el; el + x

        m[el % x] += 1
        while m[i % x] > 0:
            m[i % x] -= 1
            i += 1   
            
        stdout.write(str(i) + '\n')
    
main()
        
'''n = 0

        if i == 0:
            k = el
        
        m[el] += 1
            
        if m[0] == 0:
            mex = 0
            stdout.write(str(mex) + '\n')
            continue
        

            
        mex = 0
        t = 1
        add = 0
        i = 0
        while i < x: #k,x
            if m[i] > n:
                mex += 1
            else:
                k = i
                break
            if t and m[i] > n + 1:
                add += 1
            else:
                t = 0
            i += 1
            
        n_last = n
        n += mex // x
        if n_last == n:
            add = 0
        #print(n, 'n<<', add)
        mex = n * x + add + mex % x
        
        stdout.write(str(mex) + '\n')'''
    
    

#main()


'''print('needed', k, el)
if el != k:
    print(mex)
    continue
if k == x - 1:
    k = 0'''