#include using namespace std; int main() { int N; long long K; cin >> N >> K; long long sum = 0; vectorA(N); for(int i = 0; i < N; i++) { cin >> A[i]; sum ^= A[i]; } K -= N; if(K%(N+1) == 1) { cout << sum << endl; } else { if(K%(N+1) == 0) { cout << A[N-1] << endl; } else { cout << A[K%(N+1)-2] << endl; } } }