// Teleporter

func main() {
    let nk = readLine()!.split(separator: " ").map{Int($0)!}
    let a = [0] + readLine()!.split(separator: " ").map{Int($0)!}
    let (_, k) = (nk[0], nk[1])

    // key番の町にvalue回目に到達した記録
    var dic: [Int: Int] = [:]

    var position = 1
    for i in 1...k {
        position = a[position]
        if let pre = dic[position] {
            let cycle = i - pre
            // あまり分をループして調整
            // 逆向きのdictionaryで一発で出すこともできるはず
            let rest = (k - i) % cycle
            if rest == 0 {
                break
            }
            for _ in 1...rest {
                position = a[position]
            }
            break
        } else { 
            dic[position] = i
        }
    }

    print(position)
}

main()