const main = (input) => {
  input = input.trim().split('\n')
  const [N, K] = input[0].split(' ').map(BigInt)
  const cities = input[1].split(' ').map(v => parseInt(v, 10)-1)
  // 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 = BigInt(0)
  let loop = null

  while (true) {
    if (count === K) return console.log(current+1)

    const next = cities[current]

    if (his.includes(next)) {

      // const start = next
      const idx = his.indexOf(next)
      const untilLoop = idx
      const loopSize = his.length - idx
      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


      loop = his.slice(idx)

      break
    }

    his.push(next)
    count++
    current = next
  }

  return console.log(loop[steps]+1)
}

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