#include <bits/stdc++.h>
const int MAXN = 2e5 + 5;
const int inf = 0x3f3f3f3f;
using namespace std;
int main(int argc, char* argv[]) {
  int n, k;
  string s;
  while (cin >> n >> k) {
    cin >> s;
    if (n == k) {
      cout << s << endl;
      continue;
    }
    int l = 0, r = 0, bracket = k / 2;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '(') {
        cout << '(';
        l++;
        if (l == bracket) break;
      } else {
        cout << ')';
        r++;
      }
    }
    for (int i = r + 1; i <= bracket; ++i) {
      cout << ')';
    }
    cout << endl;
  }
  return 0;
}
