#include <bits/stdc++.h>
using namespace std;
int a[200010];
int flag[200010];
int main() {
  long long n, k;
  cin >> n >> k;
  for(int i = 1; i <= n; i++) cin >> a[i];
  
  int pos = 1, cnt = 0;
  while(k) {
    pos = a[pos];
    k--;
    cnt++;
    if(flag[pos]) k %= (cnt-flag[pos]);
    else flag[pos] = cnt;
  }
  cout << pos << "\n";
}
