#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t;
  t = 1;
  while (t--) {
    ll n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    ll k = n - m;
    ll j = 0;
    for (ll i = 0; i < n; i++) {
      while (j < n and s[i] == '(') {
        if (k == 0) break;
        ++j;
        if (s[j] == ')') {
          s[i] = '1';
          s[j] = '1';
          i++;
          k -= 2;
        }
      }
    }
    for (ll i = 0; i < n; i++) {
      if (s[i] != '1') cout << s[i];
    }
  }
}
