#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int cu = 0;
  int cnt = 0;
  int i = 0;
  string res = "";
  while (true) {
    if (cu == k) break;
    if (s[i] == '(') {
      cnt++;
      res += '(';
      cu += 2;
    } else {
      cnt--;
      res += ')';
    }
    i++;
  }
  while (cnt--) res += ')';
  cout << res;
  return 0;
}
