#https://codeforces.com/contest/1294/problem/D
import atexit
import io
import sys
 
input = sys.stdin.readline
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER
 
 
@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
 
###############################################


import sys,time
input = sys.stdin.readline
start_time = time.time()

MAX_N = int(4e5+50)
q,x = map(int,input().split())

ans = 0
visited = [0 for _ in range(x)]
for _ in range(q) :
    y = int(input())
    visited[y%x] += 1
    
    while visited[ans%x] != 0 :
        visited[ans%x] -= 1
        ans += 1
    sys.stdout.write(str(ans)+'\n')

# print("--- %s seconds ---" % (time.time() - start_time))

