import atexit
import io
import sys

input = sys.stdin.readline
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER


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


q, x = map(int, input().split())
a = [0]*x
mex = 0

for i in range(q):
    a[int(input()) % x] += 1
    while a[mex % x]>0:
        a[mex%x] -= 1
        mex += 1
    print(mex)


