#include using namespace std; int main() { int n, k; string s; stack stk; vector> v; cin >> n >> k >> s; for (int i = 0; i < n; i++) { if (s[i] == '(') { stk.push(i + 1); } else { v.push_back(make_pair(stk.top(), i + 1)); stk.pop(); } } for (auto p : v) { if (p.first == k) { cout << p.second << endl; } else if (p.second == k) { cout << p.first << endl; } } return 0; }