def solve(x, queries):
    surplus = [0] * x
    mex = 0
    for q in queries:
        surplus[q % x] += 1
        while surplus[mex % x] > 0:
            surplus[mex % x] -= 1
            mex += 1
        yield mex

if __name__ == '__main__':
    q, x = map(int, input().split())
    for result in solve(x, [int(input()) for i in range(q)]):
        print(result)
