def binarySearch(l, r, x):
    if r >= l:
        mid = l + int((r-l)/2)
        
        # If the element is present at the middle
        # Itself
        if(arr[mid] == x):
            return mid

        # If element is smaller than mid, then
        # It can only be presente in left subarray
        if(arr[mid] > x):
            return binarySearch(l, mid-1, x)
        
        # Else the element can only be present
        # in right subarray
        return binarySearch(mid+1, r, x)

    return -1 # If element isn't in array

arr = []
q, x = map(int, input().split())
mex = 0
ant = -1
for _ in range(q):
    arr.append(int(input()))
    if arr[_] == mex:
        aux = 0
        while(aux != -1):
            mex += 1
            aux = binarySearch(0, _, mex)
    elif arr[_]-x  >= 0:
        arr[_] = arr[_]-x
        aux = 0
        mex = arr[_]
    else:
        arr[_] = arr[_] + x
        aux = 0
    print(mex)