while True:
try:
n = int(input())
num_list = [int(i) for i in input().split()]
k = int(input())
if k == 0:
print('0')
else:
print(num_list[-k])
except:
break
try:
n = int(input())
num_list = [int(i) for i in input().split()]
k = int(input())
if k == 0:
print('0')
else:
print(num_list[-k])
except:
break