#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  while (s.size() > k) {
    int p = s.find("()");
    string::iterator it = s.begin() + p;
    s.erase(it, it + 2);
    while (s.size() > k) {
      p--;
      if (s[p] == '(' && s[p + 1] == ')') {
        it = s.begin() + p;
        s.erase(it, it + 2);
      } else
        break;
    }
  }
  cout << s << endl;
}
