import java.util.Scanner; public class Kakko { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt();// 全体の数4 int K = scan.nextInt();// 対象番号 String S = scan.next();// かっこ int result = 0; if (S.charAt(K - 1) == '(') { int p = 0; for (int i = K - 1; i < N; i++) { if (S.charAt(i) == '(') { p++; } else { p--; } if (p == 0) { result = i; break; } } } else if (S.charAt(K - 1) == ')'){ int p = 0; for (int i = K - 1; i < N; i--) { if (S.charAt(i) == '(') { p++; } else { p--; } if (p == 0) { result = i; break; } } } System.out.println(result+1); } }