#include #include using namespace std; int main() { int N, K, cnt = 0; string S; cin >> N >> K >> S; char c = S[--K]; while (cnt >= 0) K += c == '(' ? 1 : -1, cnt += S[K] == c ? 1 : -1; cout << K + 1 << endl; return 0; }