import java.util.*; 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(); String [] arr = S.split(""); int a=0; if( arr[K-1].equals(")") ){ while(a!=-1){ K--; if( arr[K-1].equals(")") ){ a++; }else{ a--; } } }else{ while(a!=-1){ K++; if( arr[K-1].equals("(") ){ a++; }else{ a--; } } } System.out.println(K); } }