#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string S, ans;
  cin >> S;
  int op = 0, i = 0, kapa = k;
  while (op != kapa / 2) {
    if (S[i] == '(') {
      op++;
      ans.push_back('(');
    } else {
      kapa -= 2;
      op--;
      ans.push_back(')');
    }
    i++;
  }
  while (ans.length() != k) ans.push_back(')');
  cout << ans << endl;
  return 0;
}
