import java.util.Scanner;

public class arc {
	public static void main(String args[]){
		
		//文字の読み込み
		Scanner sc=new Scanner(System.in);
		String line1=sc.nextLine();
		String line2=sc.nextLine();
		//文字の分割
		String[] ch1=line1.split(" ",0);//ch1[0]=the amount ch1[1]=question
		String[] ch2=line2.split("",0);//arcs
		
		int judge=0;
		int i=Integer.parseInt(ch1[1]);//=Integer.parseInt(ch1[1]);//この括弧のついの括弧の番号を求める
		int j=Integer.parseInt(ch1[0]);//括弧の総数
		if(ch2[i-1].equals("(")){
			for(i=i-1;i<j;i++){
		
				switch(ch2[i]){
					case "(": 
						judge++;
						break;
					case ")": 
						judge--;
						break;
				}
				
				if(judge==0){
					break;
				}
				
				if(i==(j-1)){
					i=-1;
				}
			}
		}else if(ch2[i-1].equals(")")){
			for(i=i-1;i<j;i--){
				
				switch(ch2[i]){
					case "(": 
						judge++;
						break;
					case ")": 
						judge--;
						break;
				}
				
				if(judge==0){
					break;
				}
				
				if(i==(j-1)){
					i=1;
				}
			}
		}
			

		System.out.println(i+1);
		
	}
}