#include <bits/stdc++.h>
#define N 1000000
using namespace std;
int n,k,a[N+2];
int main()
{
    freopen("CAU1.INP","r",stdin);
    freopen("CAU1.OUT","w",stdout);
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(k+1<=n)
        cout<<a[k+1];
    else
        cout<<a[k-n+1];
    return 0;
}
