import sys


def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))


def input():
    return sys.stdin.readline().rstrip()


q, x = getNM()
arr = [0] * x
n = 0
for _ in range(q):
    num = getN()
    arr[num % x] += 1
    while arr[n % x]:
        arr[n % x] -= 1
        n += 1
    print(n)
