#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
char a[N];
int n, k, delta, top, st[N];
bool vis[N];
int main() {
  scanf("%d%d", &n, &k), scanf("%s", a + 1);
  delta = (n - k) / 2, top = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == '(')
      st[++top] = i;
    else {
      if (delta) {
        --delta, vis[i] = 1;
        vis[st[top]] = 1;
      }
      --top;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) printf("%c", a[i]);
  puts("");
  return 0;
}
