#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string a;
  cin >> a;
  string ans = "";
  int st = 0;
  for (int i = 0; i < n && m; ++i) {
    if (a[i] == '(') {
      if (m == st) {
        continue;
      }
      ans += '(';
      ++st;
      --m;
    } else {
      if (st == 0) {
        continue;
      }
      ans += ')';
      --st;
      --m;
    }
  }
  cout << ans << "\n";
  return 0;
}
