#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int fr = 0, bc = 0;
  for (int i = 0; i < s.length(); i++) {
    if (fr == k / 2) break;
    if (s[i] == '(') {
      cout << s[i];
      fr++;
    } else {
      bc++;
      cout << s[i];
    }
  }
  for (int i = 1; i <= fr - bc; i++) cout << ')';
  cout << endl;
  return 0;
}
