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