import sys


n, x = map(int, sys.stdin.readline().split())

data = [0] * x
cur_res = 0
level = 0

for _ in range(n):
    num = int(sys.stdin.readline()) % x
    data[num] += 1
    pos = cur_res % x
    if num == pos:
        done = False
        for i in range(pos, x):
            if data[i] > level:
                cur_res += 1
            else:
                done = True
                break
        if not done:
            level += 1
        while not done:
            for i in range(x):
                if data[i] > level:
                    cur_res += 1
                else:
                    done = True
                    break
            if not done:
                level += 1
    print(cur_res)
