import java.util.Scanner; class Kakko{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); String str = s.next(); int count = 0; if(str.charAt(k - 1) == '('){ for(int i = k; i < n; i++){ char a = str.charAt(i); if(a == '('){ count++; }else{ count--; } if(count == -1){ System.out.println(i + 1); System.exit(0); } } }else{ for(int i = k - 2; i >= 0; i--){ char a = str.charAt(i); if(a == ')'){ count++; }else{ count--; } if(count == -1){ System.out.println(i + 1); System.exit(0); } } } } }