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; String str = S.substring(K - 1, K); if (str.equals("(")) { while (true) { str = S.substring(K, K + 1); if (c == 0) { System.out.println(K); break; } else if (str.equals("(")) { c++; K++; } else if (str.equals(")")) { c--; K++; } } } else if (str.equals(")")) { int K2 = K - 1; while (true) { if(K2==0){ str = S.substring(K2,K2 + 1); System.out.println(1); break; } if (c == 0) { System.out.println(K2 + 1); break; }else if (str.equals(")")) { c++; K2--; } else if (str.equals("(")) { c--; K2--; } } } } }