#include <bits/stdc++.h>
using namespace std;
char s[200005];
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s;
  int cnt = 0, lef = k / 2, to = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      if (lef > 0) {
        --lef;
        to = ++cnt;
        putchar('(');
      } else
        ++cnt;
    } else {
      if (cnt > to) {
        --cnt;
      } else {
        putchar(')');
        --cnt;
        --to;
      }
    }
  }
  return 0;
}
