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