#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '(')
      ++cnt;
    else
      --cnt;
    t += s[i];
    if (cnt == m - t.size()) return cout << t << string(cnt, ')'), 0;
  }
}
