import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

teleport xs i = xs !! i

teleport_list xs ys i 0 = i : []
teleport_list xs ys i n | index == Nothing = teleport_list xs ys' (teleport xs i - 1) (n - 1)
                        | otherwise = ys'
                        where
                          index = elemIndex i ys
                          ys' = ys ++ [i] 

main = do
  [n_g, k_g] <- getIntList
  xs_g <- getIntList
  let xs = map fromIntegral xs_g
  let n = fromIntegral n_g
  let k = fromIntegral k_g
  let teleport_n = teleport_list xs [] 0 n
  let loop_start = fromJust (elemIndex (last teleport_n) teleport_n)
  let loop_end = length teleport_n - 2
  let modulation = loop_end - loop_start + 1
  if k < loop_start then
    putStrLn $ show (teleport_n !! (k+1))
  else do
    let teleport_count = k - loop_start
    let teleport_index = loop_start + teleport_count `mod` modulation
    putStrLn $ show (teleport_n !! teleport_index + 1)