while True: try: n = int(input()) val = input().split() k = int(input()) for i in range(len(val)): if i == len(val) - k and (k != 0): print(val[i]) if k == 0: print(0) except: break
while True: try: n = int(input()) val = input().split() k = int(input()) for i in range(len(val)): if i == len(val) - k and (k != 0): print(val[i]) if k == 0: print(0) except: break