{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.Array.Unboxed
import Data.Array.ST
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Char

main :: IO ()
main = do
    (n,k) <- (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    vec <- VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let go :: Int -> (Int,[Int]) -> (Int,[Int])
        go 0 (count,xs) = (count,xs)
        go k (count,xs) = go ((vec VU.! k)-1) (count+1,k:xs)
    let (count,xs) = go ((vec VU.! 0) -1) (1,[0])
    print $ if vec VU.! 0 == 1 then 1 else ((reverse xs) !! (k`mod`count)) + 1