#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  string s;
  cin >> n >> k >> s;
  int cur = n;
  vector<char> res;
  for (char c : s) {
    res.push_back(c);
    if (c == ')' && cur > k) {
      res.pop_back();
      res.pop_back();
      cur -= 2;
    }
  }
  for (char c : res) cout << c;
  cout << "\n";
  return 0;
}
