#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1 << 30) #define INFLL (1LL << 60) int main() { int n,k; string str; cin >> n >> k; cin >> str; int migi = 0,hida = 0; k--; if(str[k] == '('){ hida = 1; while(true){ k++; if(str[k] == '(') { hida++; }else{ migi++; } if(migi == hida) break; } }else if(str[k] == ')'){ migi = 1; while(true){ k--; if(str[k] == '(') { hida++; }else{ migi++; } if(migi == hida) break; } } cout << k + 1 << endl; return 0; }