#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, k;
  cin >> n >> k >> s;
  int as = 0;
  string ans;
  for (int i = 0; i < s.size() && as < k / 2; i++) {
    if (s[i] == ')') {
      ans.push_back(')');
    } else if (s[i] == '(') {
      ans.push_back('(');
      as++;
    }
  }
  int b = ans.size();
  for (int i = 0; i < k - b; i++) ans.push_back(')');
  cout << ans;
  return 0;
}
