#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVI; typedef vector VVL; typedef pair P; typedef pair PL; int main() { int n, k; cin >> n >> k; VI a(n); REP(i,n) cin >> a[i]; if (n > 100) return 0; VI ans(n, -1); REP(i,n){ int mi = a[i], ma = a[i], an = a[i], oa = a[i]; FOR(j,i+1,n-1){ mi = min(mi, a[j]); ma = max(ma, a[j]); an &= a[j]; oa |= a[j]; int c = (oa - an) - (ma - mi); // cout << i << " " << j << " " << c << endl; if (c >= k){ FOR(x,i,j) ans[x] = max(ans[x], j - i +1); } } } VI result = ans; for (ssize_t i = 0; i < result.size(); i++) { cout << result[i] << (i != result.size() - 1 ? "\n" : ""); } cout << endl; return 0; }