#include #include using namespace std; int main(int argc, char* argv[]) { int n, k; cin >> n >> k; cin.setf(ios_base::skipws); string s; cin >> s; int position = k; int direction = ((s[position - 1] == '(') ? 1 : -1); int depth = direction; do { position += direction; depth += ((s[position - 1] == '(') ? 1 : -1); } while (depth != 0); cout << position << endl; return 0; }