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