#include int main(){ int n,k,i,t=0,m=-1; char s[10004]; scanf("%d%d",&n,&k); scanf("%s",&s); if (s[k-1]=='('){ for (i=0;i=0;i--){ if (k-1==i) m=t; t+=s[i]==')'?1:-1; if ((m+1)&&t==m){printf("%d",i+1);exit(0);} } } return 0; }