import java.util.Arrays; import java.util.Scanner; public class CSTINT { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(), k = s.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = s.nextLong(); /* * four[] tree; if ((n & (n - 1)) == 0) tree = new four[2 * n - 1]; else * { n = (int) (Math.log(n) / Math.log(2)); n++; n = 1 << n; tree = new * four[2 * n - 1]; } for (int i = 0; i < tree.length; i++) tree[i] = * new four(); make_tree(a, tree, 0, a.length - 1, 0); */ long[] ans = new long[n]; Arrays.fill(ans, -1); for (int i = 0; i < n; i++) { long cost = -1, max = 0, min = Integer.MAX_VALUE, or = 0, and = a[i]; boolean ok = false; for (int j = i; j < n; j++) { /* * long max = max(tree, 0, a.length - 1, 0, i, j); long min = * min(tree, 0, a.length - 1, 0, i, j); long or = or(tree, 0, * a.length - 1, 0, i, j); long and = and(tree, 0, a.length - 1, * 0, i, j); */ max = Math.max(max, a[j]); min = Math.min(min, a[j]); and = and & a[j]; or = or | a[j]; cost = (or - and) - (max - min); if (cost >= k) { ok = true; for (int x = i; x <= j; x++) ans[x] = Math.max(ans[x], j - i + 1); } } } for (int i = 0; i < a.length; i++) System.out.println(ans[i]); } static void make_tree(long[] a, four[] tree, int low, int high, int pos) { if (low == high) { tree[pos].max = a[low]; tree[pos].and = a[low]; tree[pos].or = a[low]; tree[pos].min = a[low]; return; } int mid = (low + high) >> 1; make_tree(a, tree, low, mid, 2 * pos + 1); make_tree(a, tree, mid + 1, high, 2 * pos + 2); tree[pos].max = Math.max(tree[2 * pos + 1].max, tree[2 * pos + 2].max); tree[pos].min = Math.max(tree[2 * pos + 1].min, tree[2 * pos + 2].min); tree[pos].or = tree[2 * pos + 1].or | tree[2 * pos + 2].or; tree[pos].and = tree[2 * pos + 1].and & tree[2 * pos + 2].and; } static long and(four[] tree, int low, int high, int pos, int qlow, int qhigh) { if (qlow > high || qhigh < low) return Integer.MIN_VALUE; if (qlow <= low && qhigh >= high) return tree[pos].and; int mid = (low + high) >> 1; long left = and(tree, low, mid, 2 * pos + 1, qlow, qhigh); long right = and(tree, mid + 1, high, 2 * pos + 2, qlow, qhigh); if (left == Integer.MIN_VALUE) return right; if (right == Integer.MIN_VALUE) return left; return (left & right); } static long or(four[] tree, int low, int high, int pos, int qlow, int qhigh) { if (qlow > high || qhigh < low) return 0; if (qlow <= low && qhigh >= high) return tree[pos].or; int mid = (low + high) >> 1; return (or(tree, low, mid, 2 * pos + 1, qlow, qhigh) | or(tree, mid + 1, high, 2 * pos + 2, qlow, qhigh)); } static long max(four[] tree, int low, int high, int pos, int qlow, int qhigh) { if (qlow > high || qhigh < low) return -1; if (qlow <= low && qhigh >= high) return tree[pos].max; int mid = (low + high) >> 1; return (Math.max(max(tree, low, mid, 2 * pos + 1, qlow, qhigh), max(tree, mid + 1, high, 2 * pos + 2, qlow, qhigh))); } static long min(four[] tree, int low, int high, int pos, int qlow, int qhigh) { if (qlow > high || qhigh < low) return Integer.MAX_VALUE; if (qlow <= low && qhigh >= high) return tree[pos].min; int mid = (low + high) >> 1; return (Math.min(min(tree, low, mid, 2 * pos + 1, qlow, qhigh), min(tree, mid + 1, high, 2 * pos + 2, qlow, qhigh))); } } class four { long max, min, or, and; }