class Node(object):
    def __init__(self, val) -> None:
        self.val = val
        self.next = None 

while True:
    try:
        n = input()
        array = list(map(int, input().split(" ")))
        k = int(input())
        # 正序构建单向链表
        head = Node(0)
        p = head
        for num in array:
            p.next = Node(num)
            p = p.next
		# 使用快慢指针的方式寻找倒数k的元素
        fast, slow = head, head
        for i in range(k):
            fast = fast.next
        while fast != None:
            slow = slow.next
            fast = fast.next
        print(slow.val)
    except:
        break