#include <bits/stdc++.h>
using namespace std;
int n, k, tp, cnt, num, ji, book[400010], sta[400010];
char s[200010];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == '(') sta[++tp] = i;
    if (s[i] == ')' && k) {
      k -= 2;
      book[i] = 1;
      book[sta[tp]] = 1;
      --tp;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (book[i]) {
      printf("%c", s[i]);
    }
  }
  return 0;
}
