#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define FOR(i, m, n) for(int i=(m); i<(n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define mp make_pair #define pb push_back #define dump(x) cerr << #x << " = " << (x) << endl; using LL=long long; using VI=vector; using VL=vector; using VS=vector; using VVI=vector>; using PII=pair; const int inf = (int)1e9; const LL mod = (long long)1e9 + 7; const double pi = acos(-1.0); templatevoid Sort(T & a) { sort(a.begin(), a.end()); } templatevoid ReSort(T& a) { sort(a.rbegin(), a.rend()); } templatevoid Reverse(T& a) { reverse(a.begin(), a.end()); } templatevoid Unique(T& a) { a.erase(unique(a.begin(), a.end()), a.end()); } templateauto Max(T a) { return *max_element(a.begin(), a.end()); } templateauto Min(T a) { return *min_element(a.begin(), a.end()); } templateint Count(T a, U c) { return count(a.begin(), a.end(), c); } templateU Sum(T a, U init = 0) { return accumulate(a.begin(), a.end(), init); } templateT Age(T a, T b) { return (a + b - 1) / b; } int main() { int n, k; cin >> n >> k; string s; cin >> s; k--; int ans = 0; int d = s[k] == '(' ? 1 : -1; int cnt = 1, pos = k; while (cnt != 0) { pos += d; cnt += s[pos] == '(' ? d : -d; } cout << pos + 1 << endl; }