#include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset using namespace std; int main() { int N, K; string S; cin >> N >> K >> S; int i, j; while (1) { i = 0; while (S[i] != ')') { i++; } j = i - 1; while (S[j] != '(') { j--; } if (i == K - 1) { cout << j + 1 << endl; break; } else if (j == K - 1) { cout << i + 1 << endl; break; } else { S[i] = '0'; S[j] = '0'; } } return 0; }