#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first < b.first || (a.first == b.first && a.second > b.second));
}
int main() {
  long long n, k, c1 = 0, c2 = 0;
  cin >> n >> k;
  string s, ans = "";
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(' && c1 < k / 2) {
      c1++;
      cout << "(";
    } else if (s[i] == ')' && c2 < k / 2) {
      c2++;
      cout << ")";
    }
  }
}
