#yuki1569 n,k=map(int,input().split()) a=list(map(int,input().split())) x=0 for i in a: x^=i a.append(x) n+=1 k=(k-1)%n print(a[k])