#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int open = k / 2, close = k / 2;
  int i;
  for (i = 0; i < n; i++) {
    if (s[i] == '(' && open) {
      cout << s[i];
      open--;
    }
    if (s[i] == ')' && close) {
      cout << s[i];
      close--;
    }
  }
}
