#include <bits/stdc++.h>
using namespace std;
stack<int> s1;
char a[200005];
int flag[200005];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  memset(flag, 0, sizeof(flag));
  scanf("%s", a);
  int l = 0;
  for (int i = 0; i < n; i++) {
    if (l == k) break;
    if (a[i] == '(') {
      s1.push(i);
    }
    if (a[i] == ')' && !s1.empty()) {
      l += 2;
      flag[i] = 1;
      flag[s1.top()] = 1;
      s1.pop();
    }
  }
  for (int i = 0; i < n; i++) {
    if (flag[i]) printf("%c", a[i]);
  }
  printf("\n");
}
