#!/usr/bin/env python3
import os
import sys
from atexit import register
from io import StringIO

#sys.stdin = StringIO(os.read(0, os.fstat(0).st_size).decode())
sys.stdout = StringIO()
register(lambda: os.write(1, sys.stdout.getvalue().encode()))

#input = lambda: sys.stdin.readline().rstrip('\r\n')

ret = 0
[q,x] = [int(n) for n in input().split()]

residues = {}
for n in range(x):
    residues[n] = 0

for _ in range(q):
    y = int(input())
    residues[y%x] += 1
    while residues[ret%x] > 0:
        residues[ret%x] -= 1
        ret += 1
    print(ret)
