#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[200005];
int had = 0;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  for (int i = 1; i <= n && m; i++) {
    if (s[i] == '(')
      had++, m -= 2, putchar('(');
    else {
      if (had) had--, putchar(')');
    }
  }
  for (; had; had--) putchar(')');
}
