#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, k;
  string s;
  cin >> n >> k >> s;
  int numl = 0, sta = 0;
  string ans = "";
  for (int i = (0); i <= (n - 1); ++i) {
    char v = s[i];
    if (v == '(') {
      if (numl < k / 2) numl++, sta++, ans += v;
    } else {
      if (sta > 0) sta--, ans += v;
    }
  }
  cout << ans << '\n';
  return 0;
}
