#include <stdio.h>
#include <stdlib.h>
typedef struct ListNode {
int m_nKey;
struct ListNode* m_pNext;
} LST;
int main() {
int n;
while(scanf("%d", &n) != EOF) {
LST *Head = (LST *)malloc(sizeof(LST));
LST *Last = Head;
scanf("%d", &(Head->m_nKey));
Head->m_pNext = NULL;
for(int i = 0; i < n - 1; i++) {
LST *tmp = (LST *)malloc(sizeof(LST));
scanf("%d", &(tmp->m_nKey));
Last->m_pNext = tmp;
Last = tmp;
}
Last->m_pNext = NULL;
n = 0;
Last = Head;
while(Last != NULL) {
n++;
Last = Last->m_pNext;
}
int k;
scanf("%d", &k);
Last = Head;
for(int i = 0; i < n - k; i++) {
Last = Last->m_pNext;
}
printf("%d\n", Last->m_nKey);
while(Head != NULL) {
LST *tmp = Head->m_pNext;
free(Head);
Head = tmp;
}
}
return 0;
}