#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 18:49:02 2020

@author: dennis
"""

import atexit
import io
import sys

_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

a = [1 for _ in range(4*10**5+1)]
q, x = [int(x) for x in input().split()]
removed = {y: 0 for y in range(x)}
c = 0
for _ in range(q):
    query = int(input())%x
    current = query+(x*removed[query])
    removed[query] += 1
    if current < len(a):
        a[current] = 0
    while not a[c]:
        c += 1
        if c >= len(a):
            break
    print(c)
