import math


class Read:
    @staticmethod
    def string():
        return input()

    @staticmethod
    def int():
        return int(input())

    @staticmethod
    def list(sep=' '):
        return input().split(sep)

    @staticmethod
    def list_int(sep=' '):
        return list(map(int, input().split(sep)))


def solve():
    q, x = Read.list_int()
    mex = 0
    t = {}
    for i in range(x):
        t[i] = 0

    for i in range(q):
        y = Read.int()
        c = y % x
        t[c] += 1

        m = min(t.values())
        mex += m * x

        while True:
            ct = mex % x
            if ct in t and t[ct] > 0:
                t[ct] -= 1
                mex += 1
            else:
                break
        print(mex)


query_count = 1
# query_count = Read.int()
while query_count:
    query_count -= 1
    solve()
