//EVIEBOT #include #pragma GCC optimize("O3") #pragma GCC target("sse4") #define inf 0x3f3f3f3f #define INF 1000111000111000111LL #define DEBUG(x) cout << '>' << #x << ':' << x << endl; #define fastIO ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL); #define endl '\n' #define pb push_back #define pf push_front #define fi first #define se second #define MP make_pair #define MT make_tuple #define clr(xxx) memset(xxx, 0, sizeof(xxx)); typedef long long int lli; using namespace std; ofstream outfile; ifstream infile; lli n, k, arr[100010]; bool test(int l, int r){ lli a = 0, b = INT_MAX, c = 0, d = inf; for(int i = l; i <= r; ++i){ a = a | arr[i]; b = b & arr[i]; c = max(c, arr[i]); d = min(d, arr[i]); } lli cost = (a-b) - (c-d); if(cost >= k) return true; return false; } int main() { infile.open("input.txt"); outfile.open("output.txt"); fastIO cin >> n >> k; lli i; for(i =1 ; i <= n; ++i) cin>> arr[i]; lli l, r; for(i = 1; i <= n; ++i){ lli maxi = -1; for(l= 1; l <= i; ++l){ for(r = i; r <= n; ++r){ if(test(l, r)) maxi = max(maxi, r-l+1); } } cout << maxi << "\n"; } }