import java.util.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { int n = sc.nextInt(); int k = sc.nextInt(); String s = sc.next(); Stack stack = new Stack<>(); for (int i = 1;i <= s.length();i++) { char c = s.charAt(i-1); Pair p; if (c=='(') { stack.push(new Pair(i==k,i)); } else { p = stack.pop(); if (i==k) { System.out.println(p.c); return; } else if (p.b) { System.out.println(i); return; } } } } static class Pair { boolean b; int c; public Pair(boolean b, int c) { this.b = b; this.c = c; } } }