#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string ans = "";
  long long int reqd = k / 2, op = 0, cl = 0;
  for (auto x : s) {
    if (op < reqd) {
      if (x == '(') {
        ans.push_back(x);
        op++;
      }
    }
    if (cl < reqd) {
      if (x == ')') {
        ans.push_back(x);
        cl++;
      }
    }
    if (op == reqd and cl == reqd) {
      break;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
