#!/bin/python3 import sys def costlyIntervals(n, k, A): ans = [-1] * n prev_length = 1 for i in range(n-1): mx = A[i] mn = A[i] o = A[i] a = A[i] for j in range(i+1,n): mx = max(mx, A[j]) mn = min(mn, A[j]) o = o | A[j] a = a & A[j] cost = (o-a)-(mx-mn) # print(i,j,cost) if cost >= k: ans[i] = j - i + 1 if prev_length > 1: if ans[i] >= ans[i-1]: prev_length = ans[i] else: ans[i] = ans[i-1] prev_length -= 1 else: prev_length = ans[i] if prev_length > 1: ans[n-1] = ans[n-2] return(ans) if __name__ == "__main__": n, k = input().strip().split(' ') n, k = [int(n), int(k)] A = list(map(int, input().strip().split(' '))) result = costlyIntervals(n, k, A) print ("\n".join(map(str, result)))