#include <bits/stdc++.h>
using namespace std;
int p[200005];
char s[200005], t[200005];
stack<int> q;
int n, k, i, d, j;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  cin >> s;
  d = (n - k) / 2;
  for (i = 0; i < n; i++) {
    if (s[i] == '(') {
      q.push(i);
    } else {
      if (j == d) {
        p[i] = q.top();
        p[q.top()] = i;
      } else {
        p[i] = -1;
        p[q.top()] = -1;
        j++;
      }
      q.pop();
    }
  }
  j = 0;
  for (i = 0; i < n; i++) {
    if (p[i] != -1) {
      t[j++] = s[i];
    }
  }
  t[j] = 0;
  cout << t;
  return 0;
}
