const processData = (lines) => {
  let [n, k] = lines[0].split(' ').map(x => BigInt(x))
  const towns = lines[1].split(' ').map(x => +x)

  const map = {}
  const cycle = []
  let startSlice = 0
  let pos = 0
  while(map[pos]!== 2) {
    map[pos] = map[pos] ? map[pos] + 1 : 1
    cycle.push(pos)
    pos = towns[pos] - 1
  }

  const double = Object.entries(map).find(([key, value]) => value === 2)

  const startPoint = cycle.findIndex(x => x == double[0])

  const cycleLen = cycle.slice(startPoint+1).findIndex(x => x == double[0])+1

  const refCycle = cycle.slice(startPoint, startPoint+cycleLen)

  // console.log(refCycle, startPoint)

  // console.log(k)

  if (k <= BigInt(startPoint)) {
    console.log(cycle[k]+1)
  } else {
    const inCycle = k - BigInt(startPoint)
    // console.log(inCycle)
    console.log(refCycle[inCycle % BigInt(refCycle.length)]+1)
  }

  // const t = k % BigInt(refCycle.length)

  // console.log(cycle[t])

  // while (k) {
  //   pos = towns[pos] - 1
  //   k = k - BigInt(1)
  // }
  // console.log(pos)
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})
