#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using mint = atcoder::modint998244353; const long long mod = 998244353; #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define repreq(i, a, b) for (ll i = (ll)(a); i >= (ll)(b); i--) #define sortr(v) sort(v, greater<>()) #define PI acos(-1.0L) #define TAU (PI * 2.0L) using namespace atcoder; using namespace std; typedef long long ll; template ostream &operator<<(ostream &os, const vector &v) { int n = v.size(); for (int i = 0; i < n; i++) { os << v[i] << " \n"[i == n - 1]; } return os; } template ostream &operator<<(ostream &os, const vector> &v) { int n = v.size(); for (auto &x : v) os << x; return os; } void solve(); int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cout.precision(12); cout << fixed; solve(); } void solve() { int n, k; cin >> n >> k; k--; vector a(n); rep(i, 0, n) cin >> a[i]; vector b; rep(i, 0, n) rep(j, i + 1, n) b.push_back(a[i] ^ a[j]); sort(b.begin(), b.end()); cout << b[k] << endl; }