import sys
input = sys.stdin.readline
import math
import copy
import collections
from collections import deque
inf = 10**18

q,x = map(int,input().split())
quer = []
for i in range(q):
    quer.append(int(input()))
counts = dict()
for i in range(x):
    counts[i] = 0
prev = 0
index = 0
for i in range(q):
    temp = quer[i]%x
    counts[temp]+=1
    if temp == prev%x:
        while True:
            prev+=1
            index+=1
            index%=x
            if prev//x+1 > counts[index]:
                break
    print(prev)
