#include <bits/stdc++.h>
using namespace std;
int n, k, naw, otw, zam;
char s[1000010];
int main() {
  scanf("%d%d%s", &n, &k, s + 1);
  naw = k / 2;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '(' && otw < naw) {
      otw++;
      printf("(");
    } else if (s[i] == ')' && zam < naw) {
      zam++;
      printf(")");
    }
  }
  return 0;
}
