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 (fun x -> int(x) - 1)

let ans =
    let loopOrigin, path =
        let rec search (path: int list) (towns: Set<int>) =
            let tail =
                match path with
                | tail :: _ -> tail
                | _ -> -1
            let next = a.[tail]

            if towns.Contains next then
                let path = path |> List.rev
                let loopOrigin =
                    path |> List.findIndex (fun t -> t = next)
                loopOrigin, path
            else
                search (next :: path) (towns.Add next)

        search [0] (Set [])

    let ans =
        let idx =
            let loopOrigin = int64 loopOrigin
            let freq = int64 (List.length path) - loopOrigin
            if k < loopOrigin then
                k |> int
            else
                loopOrigin + (k - loopOrigin) % freq |> int
        path.[idx] + 1

    ans

ans |> Console.WriteLine
