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 loopbackIndex = -1
var table: [Int: Int] = [0: 0]
var start = 0
while true {
  chain.append(start)
  let next = steps[start] - 1
  if table[next] != nil {
    loopbackIndex = table[next]!
    break
  }
  table[next] = chain.count
  start = next
}
if K < chain.count {
  print(chain[K] + 1)
} else {
  K -= chain.count
  let index = K % (chain.count - loopbackIndex)
  print(chain[loopbackIndex + index] + 1)
}
  