import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); String s = sc.next(); int count = 0; String[] sp = s.split(""); List kakko = new ArrayList<>(); List num = new ArrayList<>(); for (int i = 0; i < n; i++) { kakko.add(sp[i]); if (kakko.get(i).equals("(")) { count++; num.add(count); } else { count--; num.add(count); } } if (kakko.get(k-1).equals("(")) { for (int i = k-1; i < n; i++) { if (num.get(i).equals(num.get(k-1)-1) && kakko.get(i).equals(")")) System.out.println(i+1); } } else { for (int i = 0; i < k-1; i++) { if (num.get(i).equals(num.get(k-1)+1) && kakko.get(i).equals("(")) System.out.println(i+1); } } } }