import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int K = sc.nextInt() - 1; final char[] inputs = sc.next().toCharArray(); int[] trans = new int[N]; Arrays.fill(trans, -1); LinkedList open_stack = new LinkedList(); for(int index = 0; index < N; index++){ if(inputs[index] == '('){ open_stack.addFirst(index); }else{ final int open_index = open_stack.removeFirst(); trans[open_index] = index; trans[index] = open_index; } } System.out.println(trans[K] + 1); } }