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