#include using namespace std; int main(void) { int n, k; string s; cin >> n >> k >> s; int sz = s.size(); vector id(n); stack st; for (int i = 0; i < sz; i++) { if (s[i] == '(') { st.push(i); } else { int v = st.top(); st.pop(); id[i] = v; id[v] = i; } } cout << id[k - 1] + 1 << endl; return 0; }