#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<int, int>;
char s[200100];
int sum[200100], nxt[200100];
vector<int> vec;
map<int, int> pos;
int main() {
  int k, n;
  cin >> n >> k;
  cin >> (s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == '(') {
      vec.push_back(i);
      sum[i] = sum[i - 1] + 1;
    } else
      sum[i] = sum[i - 1] - 1;
  }
  pos[0] = n;
  for (int i = n - 1; i >= 1; i--) {
    if (s[i] == '(') nxt[i] = pos[sum[i - 1]];
    pos[sum[i]] = i;
  }
  vector<int> ans;
  for (int i = 1; i <= k / 2; i++) {
    ans.push_back(vec[i - 1]);
    ans.push_back(nxt[vec[i - 1]]);
  }
  sort(ans.begin(), ans.end());
  for (int id : ans) printf("%c", s[id]);
  cout << endl;
  return 0;
}
