#include <bits/stdc++.h>
using namespace std;
int n, k, otw = 0, zam = 0;
string s;
char tab[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if ((s[i] == '(') && (otw < k / 2)) {
      otw++;
      tab[otw + zam] = '(';
    } else if ((s[i] == ')') && (zam < k / 2) && (otw > zam)) {
      zam++;
      tab[otw + zam] = ')';
    }
  }
  for (int i = 1; i <= k; i++) cout << tab[i];
  cout << endl;
  return 0;
}
