#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s;
  int open = 0, close = 0, act = 0, i;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      open++;
      if (open * 2 <= m)
        t += s[i];
      else
        break;
    } else {
      close++;
      if (close <= open)
        t += s[i];
      else
        break;
    }
  }
  while (close != m / 2) t += ")", close++;
  cout << t << endl;
}
