package yukicoder; import java.util.Scanner; public class No22 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); sc.nextLine(); String S = sc.nextLine(); sc.close(); int c = 1; int K2 = K - 1; String[] str = new String[N]; for (int i = 0; i < N; i++) { str[i] = S.substring(i, i + 1); } if (str[K2].equals("(")) { while (true) { if (c == 0) { System.out.println(K2 + 1); break; }else if (str[K2 + 1].equals("(")) { c++; K2++; } else if (str[K2 + 1].equals(")")) { c--; K2++; } } }else if(str[K2].equals(")")){ while(true){ if(c == 0){ System.out.println(K2 + 1); break; }else if(str[K2 - 1].equals(")")){ c++; K2--; }else if(str[K2 - 1].equals("(")){ c--; K2--; } } } } }