from sys import stdin

q, x = map(int, stdin.readline().split())
lst, result = [0] * x, 0
for _ in range(q):
    query = int(stdin.readline())
    lst[query % x] += 1
    while lst[result % x] != 0:
        lst[result % x] -= 1
        result += 1
    print(result)
