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] * (4 * 100005)
m = 0
while q:
    q += -1
    y = int(input())
    arr[y % x] -= -1
    while arr[m % x]:
        arr[m % x] += -1
        m -= -1
    print(m)