#!/usr/bin/env python3
import os
import sys
from atexit import register
from io import BytesIO

sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))

input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

from collections import defaultdict

def solve():
    [q, x] = map(int, input().split(" ".encode()))
    mex = 0
    modmap = defaultdict(int)
    for _ in range(q):
        y = int(input())
        modmap[y % x] += 1
        # print("> mex: {0}".format(mex), y, modmap)
        while modmap[mex % x] >= 1:
            modmap[mex % x] -= 1
            mex += 1

        print(mex)


# Complexity: O(q)
# https://codeforces.com/problemset/problem/1294/D
# TODO: note down verdict
def main():
    solve()


if __name__ == "__main__":
    main()
