#include <bits/stdc++.h>
using namespace std;
int n, m, sum, t;
string s;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> m;
  cin >> s;
  for (int i = 0; i < s.size() - 1; i++) {
    if (n - sum == m) cout << s << endl, exit(0);
    if (s[i] == '(' && s[i + 1] == ')') {
      s.erase(i, 2), sum += 2;
      i -= 2;
      if (i < -1) i = -1;
    }
  }
  return 0;
}
