const main = (input) => {
  let [[N, K], arr] = input.trim().split('\n').map(v => v.split(' '))
  N = BigInt(N)
  K = BigInt(K)
  const cities = arr.map(v => parseInt(v, 10) - 1)
  const his = [0]
  let current = 0
  let steps = K
  let count = 0
  
  while (true) {
    if (count === K) return console.log(current+1)
    const next = cities[current]
    if (his.includes(next)) {
      const start = next
      const untilLoop = his.slice(0, his.indexOf(next)).length
      const loopSize = his.slice(his.indexOf(next)).length
      steps = Number((K - BigInt(untilLoop)) % BigInt(loopSize))
      // console.log('until', untilLoop)
      // console.log('loopsize', loopSize)
      // console.log('steps', steps)
      // console.log('start', start)
      // console.log(cities)
      current = start
      count++
      break
    }

    his.push(next)
    current = next
  }

  for (let i = 0; i < steps; i++) {
    current = cities[current]
  }

  return console.log(current+1)
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))