//Jacker0031
//packages
#if __has_include("extra.cpp") && __has_include(<stdint.h>)
    #include "extra.cpp"
#else
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <utility>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <cassert>
using namespace std;
#endif

// Data Type
#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double
// Loops
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define Bit                 bitset<32>
#define setbit(pos,n)       n |= (1LL<<pos)
#define resetbit(pos,n)     n &= (~(1LL<<pos))
#define toogle(pos,n)       n ^= (1LL<<pos)
#define atpos(pos,n)        ((n&(1LL<<pos))!=0)
#define bits(n)             (floor(log2(n)) + 1)
#define firstone(n)         (__builtin_ffs(n)-1)
#define countone(n)         (__builtin_popcount(n))
#define trailzero(n)        (__builtin_ctz(n))
#define leadingzero(n)      (__builtin_clz(n))

// Stl
#define pb                  push_back
#define pf                  push_front
#define eb                  emplace_back
#define popb                pop_back
#define popf                pop_front
#define mp                  make_pair
#define mt                  make_tuple
#define ff                  first
#define ss                  second
#define vll                 vector<ll>
#define vvl                 vector<vll>
#define pll                 pair<ll,ll>
#define mll                 map<ll,ll>
#define ub                  upper_bound                
#define lb                  lower_bound
#define bs                  binary_search        
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define get(tup,ind)        get<ind>(tup)
#define afterpoint(x)       fixed<<setprecision(x)   
// Maths
const double PI = 2*acos(0.0);
#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a)/(__gcd((a),(b)))*(b))
#define log(x,b)            (log(x)/log(b))
#define INF                 LLONG_MAX
// Big data
const int Mod = 1E9 + 7;
long long binpow(long long a, long long b, long long m=Mod) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
#define Mul(a,b)            (((a) % Mod)*((b) % Mod)) % Mod
#define Sum(a,b)            (((a) % Mod)+((b) % Mod)) % Mod
#define Sub(a,b)            (((a) % Mod)-((b) % Mod) + Mod) % Mod
#define Div(a,b)            Mul(a,binpow(b, Mod-2, Mod));
// Extra
#define fast                ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define scan(any)           for(auto &i:any) cin>>i;
#define print(any)          {for(auto &i:any) cout<<i<<" "; nl;}
#define printp(any)         for(auto &i:any) cout<<i.ff<<" "<<i.ss<<endl;
inline void yes()           {std::cout<<"Yes\n";}
inline void no()            {std::cout<<"No\n";}
#define flush               std::cout.flush()
#define nl                  std::cout<<'\n'
#define endl                '\n'    
using namespace std;
////////////

//NOW CODE BEGIN.
//DHARMSINH DESAI UNIVERSITY.
vll g[200001];
int main()
{
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  #ifdef Jenish
  freopen("C:/Sublime Text 3/in.txt","r",stdin);
    freopen("C:/Sublime Text 3/out.txt","w",stdout);
    #endif
    ll n,k,i;
    cin>>n>>k;
    ll a[n+1];
    ll sk=k;
    for(i=1;i<=n;i++)
    {
      cin>>a[i];
      g[i].pb(a[i]);
    }
    ll vis[n+1]={0};
    ll dist[n+1];
    queue<ll> q;
    vis[1]=1;
    q.push(1);
    ll cnt=0;
    ll cycle;
    ll flag=0;
    ll node;
    dist[1]=0;

    while(!q.empty())
    {
      ll temp=q.front();
      q.pop();
      cnt++;
        for(auto itr:g[temp])
        {
          //cout<<itr<<endl;
          if(vis[itr]==1)
            {
              
              cycle=cnt;
              flag=1;
              node=itr;

              break;
            }
            if(vis[itr]==0)
            {
            dist[itr]=dist[temp]+1;
            //cout<<dist[itr]<<endl;
            q.push(itr);
            vis[itr]=1;
          }
        }
        if(flag)
          break;
      }
      k=k-dist[node];
      cycle=cycle-dist[node];
      //cout<<cycle<<endl;
      //cout<<node<<endl;
      cycle=k%cycle;
      ll temp2=node;
      ll nex;
      ll pre=temp2;
      //cout<<pre<<endl;
      //cout<<cycle<<endl;
      if(k<=n)
    {
      temp2=1;
      for(ll i=0;i<sk+1;i++)
      { 
        pre=temp2;
        //cout<<i<<" "<<pre<<endl;
        nex=g[temp2].back();
        temp2=nex;
      }
      cout<<pre<<endl;
      return 0;

    }
      for(ll i=0;i<cycle+1;i++)
      { 
        pre=temp2;
        //cout<<i<<" "<<pre<<endl;
        nex=g[temp2].back();
        temp2=nex;
      }
      cout<<pre<<endl;

    }


    




Measured memory_bytes: 19308