import io
import os

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

q, x = map(int, input().split())

numbers = [0] * x
m = 0

for _ in range(q):
    numbers[int(input()) % x] += 1

    while numbers[m % x] != 0:
        numbers[m % x] -= 1
        m += 1

    print(m)
