#include using namespace std; typedef long long ll; typedef vector VI; typedef pair PI; const double EPS = 1e-9; #define rep(i,s,n) for(int i=(s); i < int(n); ++i) const int N = 1e6; int a[N]; int n, k; int main(void) { cin >> n >> k;k--; string s; cin >> s; int l=0; int t=-1; if(s[k]=='(') { rep(i, 0, n) { if (i == k)t=l; if(s[i]=='(')l++; else l--; if (t!= -1 && l == t) { cout << i + 1 << endl; } } }else { for(int i=n-1;i>=0;i--) { if (i == k)t=l; if(s[i]==')')l++; else l--; if (t!= -1 && l == t) { cout << i + 1 << endl; } }} }