while True:
try:
n = int(input().strip())
in_lb = input().strip().split()
out_n = int(input().strip())
if out_n == 0:
print(0)
elif len(in_lb) > 1:
print(in_lb[-out_n])
else:
print(0)
except EOFError:
break