#!/bin/python import sys from operator import ior,iand def costlyIntervals(n, k, A): cnt=0 res=[] for i in range(n): lis=[] for j in range(n): arr=A[i:i+j+1] if arr not in lis: cost_or=reduce(ior, arr) cost_and=reduce(iand, arr) cost=(cost_or-cost_and)-(max(arr)-min(arr)) if cost >= k: res.append((arr,len(arr))) lis.append(arr) ret=[] for num in A: newres=[] for item in res: if num in item[0]: newres.append(item[1]) #print num,newres if newres: ret.append(max(newres)) else: ret.append(-1) return ret # Return a list of length n consisting of the answers if __name__ == "__main__": n, k = raw_input().strip().split(' ') n, k = [int(n), int(k)] A = map(int, raw_input().strip().split(' ')) result = costlyIntervals(n, k, A) print "\n".join(map(str, result))