#include <bits/stdc++.h>
using namespace std;
int n, k;
string s, ans;
int main() {
  cin >> n >> k >> s;
  ans = "";
  k /= 2;
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      cnt1++;
      ans.push_back('(');
      if (cnt1 == k) {
        break;
      }
    } else {
      cnt2++;
      ans.push_back(')');
    }
  }
  while (cnt2 < cnt1) {
    ans.push_back(')');
    cnt2++;
  }
  cout << ans << endl;
  return 0;
}
