#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  stack<int> st;
  int mark[n];
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      st.push(i);
      mark[i] = cnt;
      cnt++;
    }
    if (s[i] == ')') {
      mark[i] = mark[st.top()];
      st.pop();
    }
  }
  int q = n / 2 - k / 2;
  for (int i = 0; i < n; i++) {
    if (mark[i] > q) cout << s[i];
  }
  return 0;
}
