#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const int MOD = 1e9 + 7;

typedef long long ll;

void solve()
{
    ll n;
    ll m;
    scanf("%lld %lld",&n,&m);
    //printf("%d",m);//printf("%ld",m);
    ll dp[n+1];
    for(int i=1;i<=n;i++){
        scanf("%lld",&dp[i]);
    }
    /*
    m%=n;
    //printf("%d %d\n",n,m);
    int pos=1;
    for(int i=0;i<m;i++){
        pos=dp[pos];
    }
    */
    ll used[n+1];
    memset(used,0,sizeof(used));
    ll pos=1;
    ll circle=1;
    do{
        if(circle==m){
            printf("%lld\n",dp[pos]);
            return;
        }
        used[pos]=circle++;
        pos = dp[pos];
    }while(used[pos]==0);
    ll tcir = circle-used[pos];
    //printf("%d %ld\n",tcir,m);
    m%=tcir;//m=((int)m)%tcir;
    //printf("%d\n",5%3);
    //printf("%d\n",m);
    for(int i=1;i<=n;i++){
        //printf("%d %d\n",m,dp[i]);
        if(used[i]==m){
            printf("%lld\n",dp[i]);
            break;
        }
    }
    return;
}
int main()
{
    int n=1;
    //scanf("%d",&n);
    while(n--){
        solve();
    }
    return 0;
}
