#include <bits/stdc++.h>
using namespace std;

int main(){
  long long int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  
  vector<int> b(0);
  vector<int> kanri(n,-1);
  int y=0;//現在地-1
  
  while(kanri.at(y)==-1){
    kanri.at(y)=b.size();
    b.push_back(y+1);
    y=a.at(y)-1;
  }
  y=kanri.at(y);//yは例外の数
  
  if(k<=y) cout << b.at(k) << endl;
  else cout << b.at((k-y)%(b.size()-y)+y) << endl;
}