#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<vector>
#include<set>
#define OmarNasr {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
using namespace std;
long long pre[200005], suf[200005],arr[2000005];
int main()
{
OmarNasr;
long long sum = 0,mx=0;
int n, k,t;
while (t--) {
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
pre[i] = arr[i] + pre[i - 1];
}
for (int i = n; i >= 1; i--) {
suf[i] = arr[i] + suf[i + 1];
}
for (int i = 0; i <= n; i++) {
int x = k - i;
if (x < 0) {
break;
}
if (x != i && x ^ i == k) {
sum = pre[i] + suf[x];
if (mx < sum) {
mx = sum;
}
}
}
cout << mx<<"\n";
}
return 0;
}
Copy