#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[200090], sumclosing = 0;
  string s, ans;
  cin >> n >> k >> s;
  for (int i = s.length() - 1; i >= 0; --i)
    if (s[i] == ')')
      a[i] = ++sumclosing;
    else
      a[i] = sumclosing;
  int opened = 0;
  for (int i = 0; i < s.length() && ans.length() < k; ++i) {
    if (s[i] == '(') {
      if (opened + 1 <= min(a[i], (int)(k - ans.length())))
        ans += "(", opened++;
    } else {
      if (opened) ans += ")", opened--;
    }
  }
  cout << ans << endl;
  return 0;
}
