import sys


def read2():
    reader = (tuple(map(int, line.split())) for line in sys.stdin)
    _, base = next(reader)

    mex = 0
    pack = [0 for _ in range(base)]
    
    cmds = list(reader)
    for cmd in cmds:
        value = cmd[0] % base
        pack[value] += 1

        while pack[mex % base]:
            pack[mex % base] -= 1
            mex += 1

        print(mex)



read2()