#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
using namespace std;
const long double eps = 1e-6;
const long long int MOD = 1e9 + 7;
const long long int MAX = 2e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<bool> v(MAX, 0);
  stack<long long int> st;
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (long long int i = 0; (i != n && k); ++i) {
    if (s[i] == '(')
      st.push(i);
    else {
      v[i] = 1;
      v[st.top()] = 1;
      st.pop();
      k -= 2;
    }
  }
  for (long long int i = 0; i != MAX; ++i) {
    if (v[i]) cout << s[i];
  }
  return 0;
}
