import java.util.Scanner; public class Yukicoder22 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt() - 1; String s = sc.next(); int i = 0, count = 0; if (s.charAt(k) == '(') { for (i = k + 1; i < s.length(); i++) { if (s.charAt(i) == '(') { count++; } else if (s.charAt(i) == ')') { if (count == 0) break; count--; } } } else if (s.charAt(k) == ')') { for (i = k - 1; i >= 0; i--) { if (s.charAt(i) == '(') { if (count == 0) break; count++; } else if (s.charAt(i) == ')') { count--; } } } System.out.println(i + 1); } }