#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n = 0, k = 0;
  scanf("%lld %lld", &n, &k);
  string s;
  cin >> s;
  stack<char> res;
  long long int temp = n;
  long long int pos = -1;
  for (long long int i = 0; i < n; i++) {
    if (temp == k) {
      pos = i;
      break;
    }
    if (s[i] == '(') {
      res.push(s[i]);
    }
    if (s[i] == ')' && !res.empty()) {
      temp -= 2;
      res.pop();
    }
  }
  string o;
  while (!res.empty()) {
    o.push_back(res.top());
    res.pop();
  }
  if (o.size() != 0) reverse(o.begin(), o.end());
  for (long long int i = pos; i < n; i++) o.push_back(s[i]);
  cout << o << endl;
  return 0;
}
