#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char s[200000], c[200000];
  cin >> s;
  int x = k / 2, r = k / 2;
  if (k == n) {
    cout << s;
    return 0;
  }
  for (int i = 0, j = 0; i < n; ++i) {
    if (s[i] == '(') {
      if (x > 0) c[j++] = '(';
      --x;
    } else {
      if (r > 0) c[j++] = ')';
      --r;
    }
  }
  cout << c << endl;
  return 0;
}
