import sys

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

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

need_to_mex = 0
mn = 0
for query in range(q):
    n = int(sys.stdin.readline().strip()) % x
    a[n] += 1
    if n == need_to_mex:
        mn = 100000
        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
    print(mex)
        
