/*
Sharif Hasan - CSE, PUST
May 10, 2020 02: 27 PM 
*/
#include<bits/stdc++.h>
#define br cout<<"\n"

/*STL definations*/
#define pb push_back

#define FOR(i,n) for(int i=0;i<n;i++)
#define FROM(a,i,n) for(int i=a;i<n;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
bool mark[2000000]={0};
/*Main function*/
int main()
{
long long n,m;
cin>>n>>m;
int arr[n+1];
FROM(1,i,n+1) cin>>arr[i];
int i=1;
vector <int> v;
while(1){
    v.pb(i);
    if(mark[i]==1) break;
    mark[i]=1;
    i=arr[i];
}
//reverse(v.begin(),v.end());
int k=0;
FOR(i,v.size()){
    if(v[i]==v[v.size()-1]){
        k=i;
        break;
    }
}

long long r=(m+k+1)%v.size();
//for(auto a:v) cout<<a<<" ";br;
//cout<<r;br;
cout<<v[r];br;
return 0;
}