#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  string p = "";
  int op = 0;
  if (b == 0) cout << p;
  for (int i = 0; i < s.size(); i++) {
    if (op == b | b == 0) break;
    if (s[i] == '(') {
      op++;
      p += s[i];
      b--;
    } else if (s[i] == ')') {
      op--;
      p += s[i];
      b--;
    }
  }
  for (int i = 0; i < b; i++) p += ")";
  cout << p << endl;
}
