#include using namespace std; using ll = long long; using ld = long double; #define rep(i, r) for(int i = 0; i < (r); ++i) #define reps(i, s, r) for(int i = (s); i < (r); ++i) #define rrep(i, a, b) for(int i = a; i >= b; i--) #define fore(i, m2) for(auto &i : m2) #define vi vector #define vl vector #define pl pair #define all(i) (i).begin(), (i).end() #define fs first #define sc second template bool chmin(T &i, T b) { if(i > b) { i = b; return true; } return false; } template bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } const ll INF = LONG_LONG_MAX / 3; const ll MOD = 1'000'000'007; const ll MAX = 1e5 + 5; #define EPS 0.000000001 using namespace std; int main() { ll n, k; string s; cin >> n >> k; cin >> s; stack stk; ll a[n]; rep(i, n) { if(s[i] == '(') { stk.push(i); } else { ll v = stk.top(); a[v] = i; a[i] = v; stk.pop(); } } cout << a[k - 1] + 1 << endl; }