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

var cities: [Int] = []
var temp = 0
while !cities.contains(temp) {
    cities.append(temp)
    temp = A[temp]
}

let start = cities.firstIndex(of: temp)!

if K < start {
    print(cities[K] + 1)
} else {
    print(A[start + (K - start) % (cities.count - start)] + 1)
}
