{-# LANGUAGE BangPatterns #-}

import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
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] <- r'
    as <- r n
    reach <- U.thaw $ U.replicate n (-1 :: Int)
    (posS,hdS,repS) <- count as reach 0 0
    -- print (posS,hdS,repS)
    let rm =  (k - hdS) `mod` repS
    -- print rm 
    print $ succ $ trace as posS rm 


count as reach ac pos = do
    h <- UM.read reach pos
    if h == -1
        then do 
            UM.write reach pos ac
            count as reach (ac+1) (as U.! pos-1)
        else return (pos,h,ac-h)

trace as pos 0 = pos
trace as pos n = trace as (as U.! pos-1) (n-1)
