_==0 "exec" "gawk" "-f" "$0" NR==1{ n=$1;k=$2;FS="" } NR==2{ for(i=1;i<=NF;i++)a[i]=$i;t=0 if(a[k]=="("){for(i=k;i<=n;i++){t=a[i]=="("?t+1:t-1;if(t==0){r=i;break}}} else{for(i=k;i>=1;i--){t=a[i]!="("?t+1:t-1;if(t==0){r=i;break}}} } END{ print r }