#!/bin/python3 import sys from operator import ior, iand from functools import reduce def costlyIntervals(n, k, A): # Return a list of length n consisting of the answers result = [-1] * n f = [] for r in range(n): for l in range(r + 1): a = A[l : r + 1] if (reduce(ior, a) - reduce(iand, a)) - (max(a) - min(a)) >= k: f.append((r - l + 1, l, r)) for p in f: for i in range(p[1], p[2] + 1): result[i] = p[0] if result[i] < p[0] else result[i] return result 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)))