#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  string s;
  cin >> n >> m;
  cin >> s;
  stack<int> open;
  vector<int> match(n), hide(n);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '(') {
      open.push(i);
    } else {
      int t = open.top();
      open.pop();
      match[t] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (m != n && match[i]) {
      m += 2;
      hide[match[i]] = hide[i] = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (!hide[i]) {
      cout << s[i];
    }
  }
  cout << endl;
}
