#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  ios::sync_with_stdio(0);
  int n, k, g;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == '(')
      a[i] = 1;
    else
      a[i] = -1;
  g = (n - k) / 2;
  stack<int> st;
  for (int i = 0; i < n && g != 0; i++) {
    if (a[i] == 1)
      st.push(i);
    else {
      a[i] = 0;
      a[st.top()] = 0;
      st.pop();
      g--;
    }
  }
  for (int i = 0; i < n; i++)
    if (a[i] == 1)
      cout << "(";
    else if (a[i] == -1)
      cout << ")";
  cout << endl;
  return 0;
}
