#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,k;cin >> n >> k; k--; string s;cin >> s; stack st; rep(i,n){ if(s.at(i)=='(') st.push(i); else{ if(i==k){ cout << st.top()+1 << endl; return 0; } else if(st.top()==k){ cout << i+1 << endl; return 0; } else st.pop(); } } }