import sys
input = sys.stdin.readline

q,x = (int(x) for x in input().split())
mex = 0
arr = [0 for _ in xrange(x+1)]
ans = []
for _ in xrange(q):
    a = int(input())
    if abs(a-mex) % x == 0:
        mex += 1
        while True:
            if arr[mex % x] > 0:
                arr[mex % x] -= 1
                mex += 1
            else:
                break
    else:
        arr[a % x] += 1
    ans.append(str(mex))
print('\n'.join(ans))
