import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); if (N < 1||N > 10000||K < 1||K > N) System.exit(1); String S = scan.next(); if (S.length()!=N) System.exit(1); Stack stackS = new Stack(); int count = 0; K--; boolean flag; if (S.charAt(K)=='(') flag = true; else flag = false; if (flag) { while (true) { if (S.charAt(K) == '(') { stackS.push(S.charAt(K)); count++; } else { stackS.pop(); count--; if (count==0) break; } K++; } } else { while (true) { if (S.charAt(K) == ')') { stackS.push(S.charAt(K)); count++; } else { stackS.pop(); count--; if (count == 0) break; } K--; } } System.out.println(K+1); } }