import Control.Applicative import Control.Monad import Data.List import Data.Maybe paren :: [Int] -> [(Char, Int)] -> [(Int, Int)] paren (s : ss) [] = [] paren (s : ss) ((x, i) : xs) | x == '(' = paren (i : s : ss) xs | otherwise = (s, i) : paren ss xs solve n k s = if a == k then b else a where (a, b) = fromJust . find (\ (a, b) -> a == k || b == k) . paren [-1] $ zip s [1 .. n] main = do [n, k] <- map read . words <$> getLine :: IO [Int] s <- getLine print $ solve n k s