#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include #endif #define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i) #define rep(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define REV(v) v.rbegin(), v.rend() #define MEMSET(v, s) memset(v, s, sizeof(v)) #define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end()) #define MP make_pair #define MT make_tuple using namespace std; typedef long long ll; typedef pair P; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; string s; cin >> s; stack st; int match[10101]; rep(i, s.size()){ if (s[i] == '(') st.push(i); else{ int x = st.top(); st.pop(); match[x] = i; match[i] = x; } } cout << match[k - 1] + 1 << endl; return 0; }