#include <bits/stdc++.h>
using namespace std;
template <class T>
void ckmin(T &a, T b) {
  a = min(a, b);
}
template <class T>
void ckmax(T &a, T b) {
  a = max(a, b);
}
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555;
const double PI = acos(-1.0);
void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int need = k / 2;
  int ca = 0, cb = 0;
  string ans = "";
  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] == '(' && need) {
      ans += '(';
      need--;
      ca++;
    } else if (s[i] == ')' && cb < ca) {
      ans += ')';
      cb++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
