#include <bits/stdc++.h>
using namespace std;
const int __ = 2e5 + 5;
char a[__];
int s[__], idx = 0;
vector<int> G;
int main() {
  int n, k;
  scanf("%d%d%s", &n, &k, a + 1);
  for (int i = (1); i <= (n); ++i) {
    if (a[i] == '(') s[++idx] = i;
    if (a[i] == ')') {
      if (!idx || !k) continue;
      G.push_back(s[idx]), G.push_back(i);
      --idx, k -= 2;
    }
  }
  sort((G).begin(), (G).end());
  for (int i = (0); i <= (((int)(G).size()) - 1); ++i) printf("%c", a[G[i]]);
  putchar('\n');
  return 0;
}
