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)

  const his = []
  let current = 0
  let loop = null
  let steps = null

  while (true) {

    const next = cities[current]

    const idx = his.indexOf(next)
    if (idx !== -1) {

      const loopSize = his.length - idx
      steps = Number((K - BigInt(idx)) % BigInt(loopSize))
      loop = his.slice(idx)

      break
    }

    his.push(next)
    current = next
  }

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

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