import java.util.Scanner; public class Yuki022 { static int N, K; static String s; public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); K = sc.nextInt() - 1; sc.nextLine(); s = sc.nextLine(); System.out.println(s.charAt(K) == '(' ? solve('(') : solve(')')); sc.close(); } static int solve(char c) { int cnt = 1; if (c == '(') { for (int i = K + 1; i < N; i++) { if (s.charAt(i) == c) cnt++; else cnt--; if (cnt == 0) { return i + 1; } } } else { for (int i = K - 1; i >= 0; i--) { if (s.charAt(i) == c) cnt++; else cnt--; if (cnt == 0) { return i + 1; } } } return -1; } }