#include <bits/stdc++.h>
using namespace std;
stack<int> place;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  vector<int> pos(n), ans(n);
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      place.push(i);
    } else {
      int g = place.top();
      place.pop();
      pos[i] = g;
      pos[g] = i;
    }
  }
  int j = 0;
  for (int i = 0; i < (n - k) / 2; i++) {
    while (s[j] != '(' || ans[j] == 1) j++;
    ans[j] = 1;
    ans[pos[j]] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] != 1) cout << s[i];
  }
}
