import Debug.Trace
import Control.Monad

import qualified Data.Set as S

inputIntList :: IO [Integer]
inputIntList = map read . words <$> getLine :: IO[Integer]

makeLoopList :: [Integer] -> S.Set Integer -> Integer -> ([Integer],[Integer])
makeLoopList a st now = do
    if S.member now st
       then ([],[now])
       else do
           let to = a !! (fromIntegral now)
           let (before_loop, loop) = makeLoopList a (S.insert now st) to
           if (before_loop == [])
                then if (last loop) == now
                        then 
                            ([now], loop)
                        else 
                            ([], now:loop)
                else (now:before_loop, loop) 

    

main = do
    [n,k] <- inputIntList
    a <- inputIntList
    let (before_loop, loop) = makeLoopList (map (subtract 1) a) S.empty 0
    print $ if length before_loop > (fromIntegral k)
               then before_loop !! (fromIntegral k)
               else loop !! (fromIntegral ((k - (fromIntegral (length before_loop))) `mod` (fromIntegral (length loop)))) + 1
