console.log(function(args){
  const _tmp = args.trim().split('\n');
  const [N,K] = _tmp[0].split(' ').map(BigInt);
  const A = [0].concat(_tmp[1].split(' ').map(v=>v|0));
  const route = [1];
  let fixed = 0, loop = 0;
  for ( let i = 0; i < N; i++ ) {
    const a = route.indexOf(A[route[i]]);
    if ( a === -1 ) route[i+1] = A[route[i]];
    else {
      fixed = BigInt(a);
      loop = BigInt(i-a+1);
      break;
    }
  }
  if ( K < fixed ) return route[K];
  index = ( (K-fixed) % loop) + fixed;
  return route[index];

}(require('fs').readFileSync('/dev/stdin', 'utf8')));
