{-# LANGUAGE BangPatterns #-}

import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Control.Arrow
--import Data.Foldable
--import Data.Char
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntSet as IS
-- import Data.Sequence as Sq

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine




main = do
    [n,k] <- map fromIntegral <$> r' :: IO [Integer]

    as <- U.map fromIntegral <$> r (fromIntegral n)
    reach <- V.thaw $ V.replicate (fromIntegral n) (-1)

    (posS,hdS,repS) <- count as reach 0 1
    -- print (posS,hdS,repS)
    let rm =  (k - hdS) `mod` repS   :: Integer
    -- print rm 
    print $ if k <= hdS then trace as 1 k else trace as posS rm 

count :: U.Vector Int -> VM.IOVector Integer -> Integer -> Int -> IO (Int,Integer,Integer)
count as reach ac pos = do
    h <- VM.read reach (pos-1)
    if h == -1
        then do 
            VM.write reach (pos-1) ac
            count as reach (ac+1) (as U.! (pos-1))
        else return (pos,h,ac-h)

trace :: U.Vector Int -> Int -> Integer -> Int
trace as pos 0 = pos
trace as pos n = trace as (as U.! (pos-1)) (n-1)




