#include <bits/stdc++.h>
using namespace std;
long long a[2000005];
int main() {
  long long n, m, i, j, k, x = 0, y = 0, z = 0, p, q = 0, r;
  string s;
  cin >> n >> k;
  cin >> s;
  stack<long long> st;
  vector<long long> v;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      st.push(i);
    } else {
      if (!st.empty()) {
        m = st.top();
        a[m]++;
        st.pop();
        a[i]++;
        x = x + 2;
        if (x == k) {
          break;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 1) {
      cout << s[i];
    }
  }
  cout << endl;
}
