open System

let n, k =
    let l = Console.ReadLine().Split(' ')
    let n = l.[0] |> int
    let k = l.[1] |> Int64.Parse
    n, k

let a =
    Console.ReadLine().Split(' ')
    |> Array.map int
    |> Array.toList
    |> List.map (fun x -> x - 1)

let ans =
    let mutable map = Map<int, int> []
    let mutable rev = Map<int, int> []

    let loopOrigin, freq =
        let mutable cur = 0
        let mutable i = 0
        let mutable freq = 0
        let mutable loopOrigin = 0
        let mutable found = false
        while not found do
            match map.TryFind cur with
            | None ->
                map <- map |> Map.add cur i
                rev <- rev |> Map.add i cur
                cur <- a.[cur]
                i <- i + 1
            | _ ->
                found <- true
                loopOrigin <- map.[cur]
                freq <- i - loopOrigin
        int64 (loopOrigin), freq

    if k < loopOrigin then
        rev.[int (k)] + 1
    else
        let idx = int (loopOrigin + (k - loopOrigin) % int64 (freq))
        rev.[idx] + 1

ans |> Console.WriteLine
