#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

template< typename T >
struct BinaryTrieNode {
  int nxt[2];
  T lazy;
  int exist; // 子ども以下に存在する文字列の数の合計
  vector< int > accept; // その文字列id

  BinaryTrieNode() : exist(0) {
    nxt[0] = nxt[1] = -1;
  }
};

template< typename T, int MAX_LOG >
struct BinaryTrie {

  using Node = BinaryTrieNode< T >;
  vector< Node > nodes;
  int root;

  BinaryTrie() : root(0) {
    nodes.push_back(Node());
  }


  virtual void direct_action(int node, int id) {}

  virtual void child_action(int node, int child, int id) {}

  void update_direct(int node, int id) {
    ++nodes[node].exist; //notice!!
    nodes[node].accept.push_back(id);
    direct_action(node, id);
  }

  void update_child(int node, int child, int id) {
    ++nodes[node].exist;
    child_action(node, child, id);
  }

  void add(const T &bit, int bit_index, int node_index, int id) {
    propagate(bit_index, node_index);
    if(bit_index == -1) {
      update_direct(node_index, id);
    } else {
      const int c = (bit >> bit_index) & 1;
      if(nodes[node_index].nxt[c] == -1) {
        nodes[node_index].nxt[c] = (int) nodes.size();
        nodes.push_back(Node());
      }
      add(bit, bit_index - 1, nodes[node_index].nxt[c], id);
      update_child(node_index, nodes[node_index].nxt[c], id);
    }
  }

  void add(const T &bit, int id) {
    add(bit, MAX_LOG, 0, id);
  }

  void add(const T &bit) {
    add(bit, nodes[0].exist);
  }

  int query(T bit, int bit_index, int node_index) {
    if(bit_index == -1) return 0;///bit;
    propagate(bit_index, node_index);
    const int c = (bit >> bit_index) & 1;
    int ret = 0;
    if(c == 0) {
      if(~nodes[node_index].nxt[0]) ret += query(bit, bit_index - 1, nodes[node_index].nxt[0]);
    } else {
      if(~nodes[node_index].nxt[0]) ret += nodes[nodes[node_index].nxt[0]].exist;
      if(~nodes[node_index].nxt[1]) ret += query(bit, bit_index - 1, nodes[node_index].nxt[1]);
    }
    return ret;
  }


  int query(const T &x) {
    return query(x, MAX_LOG, 0);
  }

  int size() const {
    return (nodes[0].exist);
  }

  int nodesize() const {
    return ((int) nodes.size());
  }

  void xorpush(const T &bit) {
    nodes[0].lazy ^= bit;
  }

  void propagate(int bit_index, int node_index) {
    const int c = (nodes[node_index].lazy >> bit_index) & 1;
    if(c) swap(nodes[node_index].nxt[0], nodes[node_index].nxt[1]);
    if(~nodes[node_index].nxt[0]) nodes[nodes[node_index].nxt[0]].lazy ^= nodes[node_index].lazy;
    if(~nodes[node_index].nxt[1]) nodes[nodes[node_index].nxt[1]].lazy ^= nodes[node_index].lazy;
    nodes[node_index].lazy = 0;
  }
};

int main() {
  int N, A[100000];
  int64 K;
  cin >> N >> K;
  K = 1LL * N * (N + 1) / 2 - K;
  for(int i = 0; i < N; i++) cin >> A[i];
  int ok = 0, ng = 1 << 20;
  auto check = [&](int x) {
    int64 ret = 0;
    BinaryTrie< int, 20 > bit;
    bit.add(0);
    for(int i = 0; i < N; i++) {
      bit.xorpush(A[i]);
      ret += bit.query(x);
      bit.add(0);
    }
    return ret;
  };
  while(ng - ok > 1) {
    int mid = (ng + ok) >> 1;
    if(check(mid) <= K) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}




Measured memory_bytes: 41552