import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //与えられる文字数 int N = sc.nextInt(); //指定された文字の番号 int K = sc.nextInt(); //与えられる文字列 String S = sc.next(); //括弧の対応表 int[] brackets = new int[S.length()]; //対応表の作成 int cnt = S.length(); while(cnt > 0) { for(int i = 0; i < S.length() - 1; i++) { if(brackets[i] != 0) { continue; } char c1 = S.charAt(i); if(c1 == ')') { break; } for(int j = i + 1; j < S.length(); j++) { if(brackets[j] != 0) { continue; } char c2 = S.charAt(j); if(c2 != ')') { break; } brackets[i] = cnt; brackets[j] = cnt; cnt -= 2; break; } } } char moji = S.charAt(K - 1); int ans = 0; int c = brackets[K-1]; if(moji == '(') { for(int i = K; i < S.length(); i++) { if(c == brackets[i]) { ans = i + 1; break; } } } else { for(int i = K - 2; i >= 0; i--) { if(c == brackets[i]) { ans = i + 1; break; } } } System.out.println(ans); } }