let s = readLine()!.split(separator: " ").map { Int($0)! }
let n = s[0], k = s[1]
let a = readLine()!.split(separator: " ").map { Int($0)! }

var now = 0, step1 = 0, step2 = 0
var past = [Bool](repeating: false, count: n)
for _ in 0..<n+1 {
  now = a[now] - 1
  if past[now] {
    step1 = now
    print(step1)
    break
  } else {
    past[now] = true
  }
}
for i in 0..<n {
  now = a[now] - 1
  if now == step1 {
    step2 = i
    break
  }
}
for _ in 0..<((k-step1)%step2) {
  now = a[now] - 1
}
print(now+1)
