import java.util.ArrayDeque; import java.util.Deque; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); String S = scan.next(); scan.close(); Deque stack = new ArrayDeque(); K--; for(int i = 0; i < N; i++) { char c = S.charAt(i); if(c == '(') { stack.push(i); }else { int k = stack.pop(); if(i == K) { System.out.println(k + 1); break; }else if(k == K) { System.out.println(i + 1); } } } } }