let [|n; k|] = stdin.ReadLine().Split " " |> Array.map int let s = stdin.ReadLine () let mutable count = 0 let countArr = [| for i in s -> if i = '(' then let c = count count <- count + 1 c else count <- count - 1 count |] let k_num = countArr.[k-1] if s.[k-1] = '(' then for i = k to s.Length-1 do if countArr.[i] = k_num then printfn "%d" (i+1) exit 0 if s.[k-1] = ')' then for i = k-2 downto 0 do if countArr.[i] = k_num then printfn "%d" (i+1) exit 0