N,K = map(int,input().split()) A = list(map(int,input().split())) Ax = A[0] for i in range(1, N): Ax ^= A[i] A.append(Ax) print(A[(K-1)%(N+1)])