#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  string res = "";
  int start = k / 2;
  int end = k / 2;
  int i = 0;
  while (start != 0 || end != 0) {
    if (start != 0 && s[i] == '(') {
      res += s[i];
      start--;
    }
    if (end != 0 && s[i] == ')') {
      res += s[i];
      end--;
    }
    i++;
  }
  cout << res << endl;
  return 0;
}
