#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  string str, s = "";
  cin >> str;
  long long int open = 0, ans = 0;
  for (long long int i = 0; i < str.length(); i++) {
    if (str[i] == '(' && open < k / 2) {
      open++;
      ans++;
      s += str[i];
    } else if (str[i] == ')') {
      if (ans > 0) {
        ans--;
        s += str[i];
      }
    }
    if (s.length() == k) break;
  }
  cout << s << endl;
}
