#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
// #include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
#include<unordered_set>
using namespace std;

int main(){
    long long int n,k;
    cin >> n >> k;
    vector<int> a(n);
    // cout << "通過1" << endl;
    rep(i,n){
        cin >> a[i];
    }
    // cout << "通過" << endl;
    vector<long long int> town_visittime(n, -1);
    bool flag = true;

    int i=0;
    int next;

    town_visittime[0] = 0;

    long long int loopstart;
    long long int loopend;
    long long int count = 0;
    vector<long long int> visittime_town;

    while(flag){
        // cout << i+1 << endl;

        if(count == k){
            cout <<  i+1 << endl;
            return 0;
        }
        next=a[i]-1;
        visittime_town.push_back(i);
        if(town_visittime[next] < 0){
            town_visittime[next] = town_visittime[i]+1;
        }
        else{
            loopstart = town_visittime[next];
            loopend = town_visittime[i];
            flag = false;                        
        }
        count++;
        i = next;
    }
    // cout << loopstart << ", " << loopend << endl;
    long long int loop = loopend - loopstart + 1;

    cout << visittime_town[loopstart + (k - (loopstart - 1) - 1)%loop]+1 << endl;

    
}