#include <bits/stdc++.h>
using namespace std;
long long INF = 1e12;
const int NUM = 1e5 + 5;
int mod = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int su[n + 1];
  su[n] = 0;
  int depth = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == ')')
      su[i] = su[i + 1] + 1;
    else
      su[i] = su[i + 1];
  }
  vector<char> ans;
  for (int i = 0; i < n; i++) {
    if (s[i] == ')' && depth > 0) {
      ans.push_back(')');
      depth--;
    }
    if (s[i] == '(') {
      if (min(su[i + 1], k - (int)ans.size()) >= depth + 1) {
        depth++;
        ans.push_back('(');
      }
    }
    if (ans.size() == k) break;
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i];
  return 0;
}
