#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n, k;
char s[maxn];
pair<int, int> lis[maxn];
stack<int> S;
int main() {
  scanf("%d%d%s", &n, &k, s + 1);
  for (int i = 1, cnt = 0; i <= n; ++i) {
    if (s[i] == '(')
      S.push(i);
    else {
      lis[++cnt] = make_pair(S.top(), i);
      S.pop();
    }
  }
  for (int i = k / 2 + 1; i <= n / 2; ++i) {
    int l = lis[i].first, r = lis[i].second;
    s[l] = s[r] = '\0';
  }
  for (int i = 1; i <= n; ++i) {
    if (s[i] != '\0') putchar(s[i]);
  }
  putchar('\n');
  return 0;
}
