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