#include <bits/stdc++.h>
using namespace std;
const int seed = 131;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int n, k;
char a[maxn];
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", a + 1);
  int cnt1 = 0;
  int cnt2 = 0;
  k /= 2;
  for (int i = 1; i <= n; i++) {
    if (cnt1 == k) break;
    if (a[i] == '(') {
      cnt1++;
    } else
      cnt2++;
    printf("%c", a[i]);
  }
  for (int i = cnt2; i < k; i++) printf(")");
  return 0;
}
