import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt()-1; char[] s = sc.next().toCharArray(); while(true) for(int i = 0; i < n; i++) { if(s[i] == ')' || s[i] == ' ') continue; if(s[i] == '(') { for(int j = i + 1; j < n; j++) { if(s[j] == ' ') continue; if(s[j] == '(') break; if(s[j] == ')') { if(i == k) { System.out.println(j+1); return; } else if(j == k) { System.out.println(i+1); return; } else { s[i] = ' '; s[j] = ' '; break; } } } } } } }