#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int xx = k / 2;
  int c = 0;
  int cc = 0;
  for (int i = 0; i < n; i++) {
    if (c < xx && s[i] == '(') {
      c++;
      cout << '(';
    } else if (cc < xx && s[i] == ')') {
      cout << ')';
      cc++;
    }
    if (c == xx) break;
  }
  while (cc < xx) {
    cout << ')';
    cc++;
  }
}
