import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); try { String[] str = buff.readLine().split(" "); int N = Integer.parseInt(str[0]); int K = Integer.parseInt(str[1]) - 1; String s = buff.readLine(); StringBuilder line = new StringBuilder(s); boolean flag = true; int ans = -1; for (int i = 0; i < N && flag; ++i) { if (line.charAt(i) == '(') { for (int j = i + 1; j < N; ++j) { if (line.charAt(j) == '(') { break; } if (line.charAt(j) == ')') { if (i == K) { ans = j; flag = false; } else if (j == K) { ans = i; flag = false; } else { line.setCharAt(i, ' '); line.setCharAt(j, ' '); i = -1; } break; } } } } System.out.println(ans + 1); } catch (NumberFormatException e) { } catch (IOException e) { } } }