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