import java.util.Scanner; public class No022_SupprotBrackets { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); // 文字数 int b = sc.nextInt(); // 対象番号 String s = sc.next(); // 文字列 final String LB = "("; final String RB = ")"; int cnt = 0; if (LB.equals(s.substring(b-1,b))) { for (int i=b; i0; i--) { if (LB.equals(s.substring(i-1, i))) cnt--; if (RB.equals(s.substring(i-1, i))) cnt++; if (cnt <= 0) { System.out.println(i); break; } } } } }