#https://codeforces.com/contest/1294/problem/D

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
    print(ans)

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

