import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int K = scanner.nextInt(); // K = K - 1; String str = scanner.next(); // BufferedReader input = new BufferedReader ( // new InputStreamReader (System.in)); // try { // str = input.readLine(); // } catch (IOException e) { // e.printStackTrace(); // } scanner.close(); List list = Arrays.asList(str.split("")); int count = 0; boolean flag1 = true; while(flag1) { count ++; if(count > 20) { break; } for(int i = 0; i < N; i++) { if(list.get(i).equals(")")) { list.set(i, "0"); for(int j = i - 1; j > -1; j--) { if(list.get(j).equals("(")) { list.set(j, "0"); if(i == K) { System.out.println(j + 1); flag1 = false; }else if(j == K) { flag1 = false; System.out.println(i + 1); } break; } } } if(flag1 == false) { break; } } } } }