import sys def cost(a): x = 0 y = 1 for i in a: x |= i y &= i return((x-y)-(max(a)-min(a))) def costlyIntervals(n, k, A): ans = [] for m in range(n): cs = -1 for i in range(0,n-1): for j in range(i,n): l = A[i:j+1] if A[m] in l: x = cost(l) if x >= k: cs = max(cs,len(l)) ans.append(cs) 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)))