import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); String s = sc.next(); int[] coresspond = new int[N]; int a = 0; int b = N - 1; while(a < b) { boolean flg = true; if(s.charAt(a + 1) == ')') { coresspond[a] = a + 1; coresspond[a + 1] = a; a += 2; flg = false; } if(s.charAt(b - 1) == '(') { coresspond[b] = b - 1; coresspond[b - 1] = b; b -= 2; flg = false; } if(flg) { coresspond[a] = b; coresspond[b] = a; a++; b--; } } System.out.println(coresspond[K - 1] + 1); } }