#include <bits/stdc++.h>
using namespace std;
stack<char> s;
stack<char> c;
char str[200005];
int main() {
  long long int n, k, a;
  char b;
  scanf("%lld%lld", &n, &k);
  cin >> str;
  a = n;
  if (n == k)
    cout << str;
  else {
    if (str[0] == '(') s.push(str[0]);
    for (int i = 1; i < n; i++) {
      if (a == k) {
        s.push(str[i]);
        continue;
      }
      if (s.empty())
        s.push(str[i]);
      else if (str[i] == s.top())
        s.push(str[i]);
      else {
        s.pop();
        a = a - 2;
      }
    }
    while (!s.empty()) {
      c.push(s.top());
      s.pop();
    }
    while (!c.empty()) {
      b = c.top();
      cout << b;
      c.pop();
    }
  }
  return 0;
}
