from collections import *
from math import *
from sys import *

arr = [int(x) for x in stdin.readline().split()] 
q = arr[0]
x = arr[1]
d = defaultdict(lambda : 0)
mn = 0


for _ in range(q):
    
    s = stdin.readline()
    s = int(s)
    if(s>=mn):
        r = (s - mn)%x
        d[mn+r] = 1
    else:
        r = ceil((mn - s)/x)
        r = int(r)
        d[s + r*x] = 1
    
    while(d[mn] == 1):
        mn += 1
        
    stdout.write(str(mn)+'\n')
   # print()