import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); try { String[] elements = stdReader.readLine().split(" "); int N = Integer.parseInt(elements[0]); int K = Integer.parseInt(elements[1])-1; String c = stdReader.readLine(); int count = 0; if((""+c.charAt(K)).equals("(")){ for(int i=K;i<N;i++){ if((""+c.charAt(i)).equals("(")) count++; else count--; if(count == 0){ System.out.println(i+1); break; } } }else{ for(int i=K;0<=i;i--){ if((""+c.charAt(i)).equals(")"))count++; else count--; if(count == 0){ System.out.println(i+1); break; } } } } catch (IOException e) { e.printStackTrace(); } } }