while True:
try:
n, nums, k = int(input()), input().split(), int(input())
if k:
print(nums[n-k])
else:
print(0)
except:
break
while True:
try:
n, nums, k = int(input()), input().split(), int(input())
if k:
print(nums[n-k])
else:
print(0)
except:
break