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