#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main(){ int n, k; string S; cin >> n >> k >> S; stack st; int A[n] = {}; REP(i, n){ if(S[i] == '('){ st.push(i); continue; } int tmp = st.top(); st.pop(); A[i] = tmp; A[tmp] = i; } cout << A[k - 1] + 1 << endl; return 0; }