#include #include #include #define FOR(i,s,e) for(int i = (s);i <= (e);i++) using namespace std; int N,K; string S; int memo[10000]; int main() { cin >> N >> K; cin >> S; stack s; FOR(i,0,N - 1) { if(S[i] == '(') { s.push(i); } else { int x = s.top(); s.pop(); memo[x] = i; memo[i] = x; } } cout << memo[K - 1] + 1 << endl; return 0; }