import java.util.* fun main(args: Array) { val map:Map = mapOf('(' to 1, ')' to -1) val sc = Scanner(System.`in`) val l = Integer.parseInt(sc.next()) val startIndex = Integer.parseInt(sc.next()) -1 val b = sc.next() //括弧の文字列 val startChar = b.get(startIndex) //開始位置の文字 val dir = map.getOrElse(startChar, {0}) var index = startIndex var count = 0 do { index += dir count += if(b.get(index).equals(startChar)) 1 else -1 } while(count > -1) println (index + 1) }