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