#include #include #include #include #include using namespace std; #define SZ(a) int((a).size()) #define REP(i,n) for(int i=0,_n=(n);i<_n;++i) #define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i) typedef long long llong; typedef vector VI; typedef vector VVI; #define MAXN 100004 int N, K; int A[MAXN]; void solve() { VI longest(N, -1); REP(i, N) { llong or_sum = 0, and_sum = 0x3fffffff; int mx = -1000000001, mn = 1000000001; FOR(j, i, N-1) { int x = A[j]; mx = max(mx, x); mn = min(mn, x); or_sum = or_sum | x; and_sum = and_sum & x; llong cost = or_sum; cost -= and_sum; cost -= (mx - mn); // cerr << i+1 << " " << j+1 << " " << cost << endl; if (cost >= K) longest[i] = j; } } REP(i, N) { int best = -1; for (int start = i; start >= 0; --start) { if (longest[start] < 0 || longest[start] < i) continue; int len = longest[start] - start + 1; best = max(best, len); } cout << best << '\n'; } } int main(int argc, char* argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> N >> K; REP(i, N) cin >> A[i]; solve(); return 0; }