#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() using namespace std; typedef long long LL; typedef vector VI; int main() { int n, k; string s; cin >> n >> k >> s; stack st; int h[10101]; REP(i, n) { if (s[i] == '(') st.push(i + 1); else { int t = st.top(); h[i] = t; h[t] = i; st.pop(); } } cout << h[k - 1] << endl; return 0; }