import java.util.Scanner; public class No22 { 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 str[] = S.split(""); int count = 0; int i = K - 1; while(true) { if(str[i].equals("(")){ count++; }else { count--; } if(count == 0) { break; } if(str[K - 1].equals("(")) { i++; }else { i--; } } System.out.println(i + 1); } }