import java.util.Scanner;
public class Test {
static class ListNode{
int data;
ListNode next;
public ListNode(int data){
this.data = data;
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int n = scanner.nextInt();
ListNode headl = new ListNode(0);
ListNode a = new ListNode(0);
for (int i = 0; i < n; i++) {
headl.data = scanner.nextInt();
if(i < n-1){
headl.next = new ListNode(0);
}
if (i == 0) {
a = headl;
}
headl = headl.next;
}
headl = a;
int key = scanner.nextInt();
System.out.println(FindKthToTail(headl, key));
}
}
public static int FindKthToTail(ListNode head, int k) {
k=k+1;
if (head == null)
return 0;
ListNode P1 = head;
while (P1 != null && k-- > 0)
P1 = P1.next;
if (k > 0)
return 0;
ListNode P2 = head;
while (P1 != null) {
P1 = P1.next;
P2 = P2.next;
}
return P2.data;
}
}