#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
string st, st2, st3, st4, ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  int i, j, a, b, n, m, x, y, ck, t, r, rem, cnt, lo, hi, sum, cs = 1;
  cin >> n >> m;
  cin >> st;
  a = b = m / 2;
  for (i = 0; i < n; i++) {
    if (st[i] == '(' && a > 0) ans += '(', a--;
    if (st[i] == ')' && b > 0) ans += ')', b--;
  }
  cout << ans;
}
