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(); char[] arr = sc.next().toCharArray(); int count = 0; if (arr[k - 1] == '(') { for (int i = k - 1; ; i++) { if (arr[i] == '(') { count++; } else { count--; } if (count == 0) { System.out.println(i + 1); return; } } } else { for (int i = k - 1; ; i--) { if (arr[i] == '(') { count++; } else { count--; } if (count == 0) { System.out.println(i + 1); return; } } } } }