import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Deque; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; public class Main{ public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String[] N = br.readLine().split(" "); int cntString = Integer.parseInt(N[0]); int index = Integer.parseInt(N[1]); String[] str = br.readLine().split(""); Deque deq = new LinkedList<>(); Map map = new HashMap<>(); for (int i = 0; i < cntString; i++) { if (str[i].equals("(")) { deq.addFirst(i); } else { int j = deq.removeFirst(); map.put(i, j); map.put(j, i); } } System.out.println(map.get(index - 1) + 1); } catch (IOException e) { e.printStackTrace(); } } }