#include <bits/stdc++.h>
using namespace std;
string pushbackpart(int i, int j, string s) {
  string temp = "";
  temp = s.substr(i, j - i + 1);
  return temp;
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string ans = "";
  stack<int> st;
  vector<vector<int> > v;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      st.push(i);
    else {
      vector<int> temp(2);
      temp[0] = st.top();
      temp[1] = i;
      st.pop();
      v.push_back(temp);
    }
  }
  vector<int> vk(n, 0);
  for (int i = 0; i < k / 2; i++) {
    vk[v[i][0]] = 1;
    vk[v[i][1]] = 2;
  }
  for (int i = 0; i < n; i++) {
    if (vk[i] == 1)
      ans += "(";
    else if (vk[i] == 2)
      ans += ")";
  }
  cout << ans << endl;
  return 0;
}
