#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
char s[maxn];
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  scanf("%s", s);
  int cnt = 0, cnt2 = 0;
  k /= 2;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      printf("(");
      cnt++;
      if (cnt == k) break;
    } else {
      printf(")");
      cnt2++;
    }
  }
  while (cnt2 < cnt) printf(")"), cnt2++;
  printf("\n");
  return 0;
}
