#include using namespace std; int main(){ int n,k; string str; cin >> n >> k >> str; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++){ if(str[j] == ' ') continue; else if(str[i] == '(' and str[j] == ')'){ str[i] = ' '; str[j] = ' '; // cout << i+1 << " " << j+1 << endl; // cout << str << endl; if(i+1 == k){ cout << j + 1 << endl; return 0; } if(j + 1 == k){ cout << i + 1 << endl; return 0; } while(str[i] != '(') i--; } else i = j; } } return 0; }