import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), idx = 0; int[] t = new int[n], st = new int[n]; String s = sc.next(); for(int i = 0; i < n; i++){ if(s.charAt(i) == '('){ st[idx] = i; idx++; } else { idx--; t[i] = st[idx]; t[st[idx]] = i; } } System.out.println(t[k-1]+1); } }