import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;

//struct ListNode // { // int m_nKey; // ListNode* m_pNext; // }; public class Main{ public static void main(String[]args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = null; while((str = in.readLine()) != null){ int num = Integer.parseInt(str); String[] s = in.readLine().split(" "); int[] arr = new int[s.length]; for(int i = 0;i < s.length;i ++ ){ arr[i] = Integer.parseInt(s[i]); } ListNode head = createList(arr); int k = Integer.parseInt(in.readLine()); if(k <= 0){ System.out.println(0); continue; } ListNode pre = head; ListNode post = head; while(k -- > 0 && pre != null){ pre = pre.next; } while(pre != null){ pre = pre.next; post = post.next; } System.out.println(post.key);

    }

}
public static ListNode createList(int[] arr){
    ListNode head = new ListNode();
    ListNode tail = head;
    for(int i = 0;i < arr.length;i++){
        ListNode temp = new ListNode();
        temp.key = arr[i];
        temp.next = null;
        tail.next = temp;
        tail = temp;
    }
    return head;
}
public static class ListNode{
    int key;
    ListNode next;

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public ListNode getNext() {
        return next;
    }

    public void setNext(ListNode next) {
        this.next = next;
    }
}

}