import java.util.Scanner;
public class Kakko{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,k,res=0,count=0,kc,c,temp=0;
		String s;
		n = sc.nextInt();
		k = sc.nextInt();
		s = sc.next();
		int[] m = new int[n];
		for(int i = 0;i<n;i++){
			if(s.charAt(i) == '('){
				count++;
				m[i] = count;
			}else{
				m[i] = count;
				count--;
			}
		}
		count = 0;
		kc = m[k-1];
		for(int i = 0;i<n;i++){
			if(m[i] == kc){
				count++;
				if(i == k - 1){
					c=count;
					if(c%2 == 0){
						res = temp+1;
						break;
					}else{
						i++;
						for(;i<n;i++){
							if(m[i] == kc){
								res = i+1;
								break;
							}
						}
						break;
					}
				}
				temp = i;
			}
		}
		System.out.println(res);
	}
}