import os, sys, atexit
from io import BytesIO, StringIO
 
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
_OUTPUT_BUFFER = StringIO()
sys.stdout = _OUTPUT_BUFFER
 
@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
 
q, x = map(int, input().split())
arr = [0] * (x + 5)
m1 = 0
while q:
    q += -1
    y = int(input())
    y = y % x
    if arr[y] == 1:
        for i in range(y, x + 5, x):
            if arr[i] != 1:
                arr[i] = 1
                break
    else:
        arr[y] = 1
    for i in range(m1, x + 5):
        if arr[i] != 1:
            m1 = i
            break
    print(m1)