import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { 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[] S = sc.next().toCharArray(); LinkedList stack = new LinkedList(); for(int i = 0; i < N; i++){ if(S[i] == '('){ stack.push(i * (i == K ? -1 : 1)); }else{ final int value = stack.pop(); if(value < 0){ System.out.println(i + 1); return; }else if(i == K){ System.out.println(value + 1); return; } } } } }