#include int main(void) { int n,k,c=1,i; char s[16384]; scanf("%d%d%s",&n,&k,s); i = k - 1; if(s[i] == '('){ while(1){ i++; if(s[i] == ')'){c--;}else{c++;} if(!c){printf("%d\n",i+1);break;} } } else{ while(1){ i++; if(s[i] == '('){c--;}else{c++;} if(!c){printf("%d\n",i+1);break;} } } return 0; }