import java.util.Scanner; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); String s = in.next(); char[] c = s.toCharArray(); int mv = 1; k--; if(c[k] == ')') mv = -1; int cnt = 0; for(int i=k+mv; cnt!=1; i+=mv) { if(c[i] == c[k]) cnt--; else cnt++; if(cnt == 1) { System.out.println(i+1); break; } } in.close(); } }