import atexit
import io
import sys

_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER


@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())


from collections import defaultdict

q, x = map(int, input().split())

mex = 0

pending = defaultdict(int)

for _ in range(q):

    y = int(input())

    pending[y % x] += 1

    while pending[mex % x] > 0:
        pending[mex % x] -= 1
        mex += 1

    print(mex)
