#include using namespace std; int main(){ int n,k,count = 0; string s; cin >> n >> k >> s; if(s[k - 1] == '('){ for(int i = k - 1;i < n;i++){ if(s[i] == ')'){ if(count-- == 0){ cout << i << endl; return 0; } }else count++; } }else{ for(int i = k - 1;i--;){ if(s[i] == '('){ if(count-- == 0){ cout << i << endl; return 0; }else count++; } } } }