let first = readLine()!.split(separator: " ")
let N = Int(first[0])!
var K = Int(first[1])!
let steps = readLine()!.split(separator: " ").map { Int($0)! }

var chain: [Int] = []
var visited = Set<Int>()
var loopbackIndex = -1
visited.insert(0)
var start = 0
while true {
  chain.append(start)
  let next = steps[start] - 1
  if visited.contains(next) {
    loopbackIndex = next
    break
  }
  visited.insert(next)
  start = next
}
if K < chain.count {
  print(chain[K] + 1)
} else {
  K -= loopbackIndex
  let index = K % (chain.count - loopbackIndex)
  print(chain[index] + 1)
}
  