#include <bits/stdc++.h>

using namespace std;

#define data_type long long

#define endl "\n"

int main()

{

    //ios_base::sync_with_stdio(false);

    //cin.tie(NULL);

    data_type n,k,counter,x=0;

    cin>>n>>k;

    counter=k;

    vector<data_type>vc(n),ans;

    for(auto &i:vc)

        cin>>i,--i;

    bitset<200001> is_visited;

    while(!is_visited[x] && counter--)

        {

            ans.push_back(x+1);

            is_visited[x]=true;

            x=vc[x];

        }

    if(counter==-1)

        return cout<<x<<endl,0;

    data_type in=distance(ans.begin(),find(ans.begin(),ans.end(),x+1));

    cout<<ans[(k-in+1)%(ans.size()-in+1)]<<endl;

    return 0;

}

