#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k;
  string s;
  cin >> (n);
  cin >> (m);
  cin >> (s);
  k = n;
  stack<pair<long long, long long>> pos;
  stack<long long> st;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '(') {
      st.push(i);
    } else {
      long long a = st.top();
      st.pop();
      pos.push(make_pair(a, i));
    }
  }
  bool ar[n + 1];
  memset(ar, 1, sizeof(ar));
  while (n > m) {
    pair<long long, long long> x = pos.top();
    pos.pop();
    ar[x.first] = 0;
    ar[x.second] = 0;
    n -= 2;
  }
  for (long long i = 0; i < k; i++) {
    if (ar[i]) {
      cout << (s[i]);
    }
  }
  cout << ("\n");
}
