#!/usr/bin/python
# -*- coding: UTF-8 -*-



lens, n = input().split()
lens = int(lens)

nums = [0 for j in range(lens)]
dicts = {}
res,temp = 0,0

n = int(n)


for i in range(lens):

    a = input()
    a = int(a)

    nums[i] = a

    if a == temp or a + n == temp:
        temp = temp + 1
        while temp in dicts.keys():
            temp = temp+1
    #elif a + n == temp:
        #temp = temp + 1
    #elif a < temp :
        #continue
    elif a>temp:
        dicts[a] = 1
        

    res = temp
    print(res)





