#include using namespace std; int main(){ int n, m; string s; while(cin >> n >> m >> s){ int dir = 1; int level = 1; if(s[m - 1] == ')') dir = level = -1; int idx = m - 1; while(level != 0){ idx += dir; if(s[idx] == '('){ level++; } else{ level--; } } cout << idx + 1 << endl; } }