import Debug.Trace
import Control.Monad
import Data.Array
import qualified Data.Set as S

findLoopPath :: Int -> Array Int Int -> S.Set Int -> Int -> ([Int],[Int])
findLoopPath n aas st now = if S.member now st
                                then ([now],[now])
                                else do
                                    let next = aas!now
                                    let (before_loop_path, loop_path) = findLoopPath n aas (S.insert now st) next
                                    if (head before_loop_path == now) || (length before_loop_path > 1)
                                        then (now:before_loop_path, loop_path)
                                        else (before_loop_path, now:loop_path)

solve :: ([Int],[Int]) -> Integer -> Int
solve (before_loop_path, loop_path) k = do
    if fromIntegral(length before_loop_path) > k
        then before_loop_path !! fromIntegral k
        else do
            let llp = fromIntegral . length $ loop_path
            let lblp = fromIntegral . length $ before_loop_path
            loop_path !! fromIntegral ((k-lblp) `mod` llp)


main = do
    [_n,k] <- map read . words <$> getLine :: IO[Integer]
    as <- map read . words <$> getLine :: IO[Int]
    let n = fromIntegral(_n)
    let aas = array (1,n) $ zip [1..] as
    let paths = findLoopPath n aas S.empty 1
    print $ solve ((init . fst $ paths), snd paths) k
