import java.util.Scanner; public class Main{ static final Scanner s =new Scanner(System.in); public static void main(String args[]){ input(); solve(); } static int n,k; static String in; private static void input(){ n=s.nextInt(); k=s.nextInt()-1; in=s.next(); } private static void solve(){ int depth=0,i=k; switch(in.charAt(k)){ case '(': while(true) { i++; if(depth==0&&in.charAt(i)==')') { System.out.println(i+1); return; } depth+=in.charAt(i)=='('?1:-1; } case ')': while(true) { i--; if(depth==0&&in.charAt(i)=='(') { System.out.println(i+1); return; } depth+=in.charAt(i)==')'?1:-1; } } } }