import java.io.*; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = sc.nextInt(); int[][] cost = new int[n][n]; for (int i = 0; i < n; i++) { int and = a[i], or = a[i], max = a[i], min = a[i]; for (int j = i; j < n; j++) { and &= a[j]; or |= a[j]; max = Math.max(max, a[j]); min = Math.min(min, a[j]); cost[i][j] = (or - and) - (max - min); } } int[] result = new int[n]; for (int i = 0; i < n; i++) { int max = -1; for (int l = 0; l <= i; l++) { for (int r = i; r < n; r++) { if (cost[l][r] >= k) max = Math.max(max, r - l + 1); } } result[i] = max; } for (int i = 0; i < result.length; i++) { System.out.print(result[i] + (i != result.length - 1 ? "\n" : "")); } System.out.println(""); out.flush(); out.close(); } static class Scanner { StringTokenizer st; BufferedReader br; public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));} public Scanner(FileReader s) throws FileNotFoundException { br = new BufferedReader(s);} public String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public int nextInt() throws IOException {return Integer.parseInt(next());} public long nextLong() throws IOException {return Long.parseLong(next());} public String nextLine() throws IOException {return br.readLine();} public double nextDouble() throws IOException { return Double.parseDouble(next()); } public boolean ready() throws IOException {return br.ready();} } }