#include <bits/stdc++.h>
using namespace std;
char s[2000000 + 5];
int deepK[2000000 + 5];
int n, k;
bool flag;
void dfs(int pos, int deep) {
  if (pos > n) return;
  if (s[pos] == '(') {
    if (k) {
      printf("(");
      deepK[deep + 1] = 1;
      k--;
    } else
      deepK[deep + 1] = 0;
    dfs(pos + 1, deep + 1);
  } else if (s[pos] == ')') {
    if (deepK[deep]) printf(")");
    dfs(pos + 1, deep - 1);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  k /= 2;
  scanf("%s", s + 1);
  dfs(1, 1);
}
