#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  stack<int> st;
  vector<bool> visited(n, false);
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      st.push(i);
    } else {
      if (!st.empty()) {
        visited[st.top()] = true;
        visited[i] = true;
        st.pop();
        count += 2;
        if (count == k) break;
      }
    }
  }
  string res = "";
  for (int i = 0; i < n; i++) {
    if (visited[i] == true) {
      res += s[i];
      cout << s[i] << "";
    }
  }
}
