#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); ll N, K; cin >> N >> K; vector A(N); rep(i, 0, N) cin >> A[i]; A.push_back(0); rep(i, 0, N) A[N] ^= A[i]; K--; K %= N + 1; cout << A[K] << '\n'; }