#include #include #include #include #define ALL(x) (x).begin(),(x).end() #define REP(i,n) for(int i = 0;i < (n);i++) using namespace std; int main(){ int n,k; string s; cin >> n >> k >> s; int count = 0,i; for(i = k-1;;i += s[k-1] == '(' ? 1 : -1){ if(s[i] == '(')count++; else if(s[i] == ')')count--; if(count == 0)break; } cout << i + 1 << endl; return 0; }