import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long K = sc.nextInt(); long[] A = new long[N+1]; for( int i = 0; i < N; i++ ) { A[i] = sc.nextLong(); A[N] ^= A[i]; } int k = (int)((K-1)%(N+1)); System.out.println(A[k]); } }