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) { if(s.charAt(a + 1) == ')') { coresspond[a] = a + 1; coresspond[a + 1] = a; a += 2; } else if(s.charAt(b - 1) == '(') { coresspond[b] = b - 1; coresspond[b - 1] = b; b -= 2; } else { coresspond[a] = b; coresspond[b] = a; a++; b--; } } System.out.println(coresspond[K - 1] + 1); } }