#include <bits/stdc++.h>
using namespace std;
int n, k, maxNest = -1, nest = 0, curSz = 0;
string s;
stack<int> braqSeq;
vector<vector<pair<int, int> > > braqs;
vector<int> nestSz;
int main() {
  scanf("%d %d", &n, &k);
  curSz = n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      nest++;
    else {
      if (nest > maxNest) maxNest = nest;
      nest--;
    }
  }
  nest = 0;
  braqs.resize(maxNest);
  nestSz.resize(maxNest);
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      nest++;
      braqSeq.push(i);
    } else {
      braqs[maxNest - nest].push_back({braqSeq.top(), i});
      nestSz[maxNest - nest]++;
      braqSeq.pop();
      nest--;
    }
  }
  bool isDone = 0;
  for (int i = 0; i < braqs.size(); i++) {
    for (int j = 0; j < braqs[i].size(); j++) {
      if (curSz > k) {
        s[braqs[i][j].first] = 0;
        s[braqs[i][j].second] = 0;
        curSz -= 2;
      } else {
        isDone = true;
        break;
      }
    }
    if (isDone) break;
  }
  for (int i = 0; i < n; i++)
    if (s[i] != 0) printf("%c", s[i]);
}
