#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b) {
  if (b == 0)
    return 1;
  else {
    int c = pow(a, b / 2);
    if (b % 2 == 0)
      return c * c;
    else
      return a * c * c;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  k = k / 2;
  int i, j, l;
  for (i = 0, j = 0, l = 0; j < n; ++j) {
    if (s[j] == '(' && i < k) {
      cout << s[j];
      i++;
    } else if (s[j] == ')' && l < i) {
      cout << s[j];
      l++;
    }
  }
  return 0;
}
