#include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; int t; cin>>t; map dp; dp[t]=0; rep(i,n){ int x; cin>>x; map ndp; for(auto e:dp){ ndp[e.first|x] = max(ndp[e.first|x],e.second + (e.first|x) - e.first); ndp[e.first&x] = max(ndp[e.first&x],e.second + e.first - (e.first&x)); } dp.swap(ndp); } ll ma=0; for(auto e:dp)ma=max(e.second, ma); cout<