#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> use(n, 1);
  long long cnt = 0;
  for (int i = 0; i < n; i++) {
    if (cnt >= (n - k) / 2) break;
    if (s[i] == '(') continue;
    use[i] = 0;
    cnt++;
  }
  cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (cnt >= (n - k) / 2) break;
    if (s[i] == ')') continue;
    use[i] = 0;
    cnt++;
  }
  string res = "";
  for (int i = 0; i < n; i++) {
    if (use[i]) res += s[i];
  }
  cout << res << endl;
}
