import java.util.* fun main(args: Array) { val cin = Scanner(System.`in`) val length :Int = Integer.parseInt(cin.next()) val startIndex :Int = Integer.parseInt(cin.next()) -1 val brackets :String = cin.next() val startBracket = brackets.get(startIndex) val direction :Int = if(startBracket.equals('(')) 1 else -1 var index = startIndex var counter :Int = 0 do { index += direction counter += if(brackets.get(index).equals(startBracket)) 1 else -1 } while(counter > -1) println (index + 1) }