import Control.Monad

import qualified Data.Set as S

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

makeLoopList :: [Int] -> S.Set Int -> Int -> ([Int],[Int])
makeLoopList a st now = do
    if S.member now st
       then ([],[now])
       else do
           let to = a !! 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 >= k
               then before_loop !! (k-1)
               else loop !! ((k - (length before_loop)) `mod` (length loop)) + 1
