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