import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto S = readln.chomp;

    auto st = new int[](N*2);
    int p = -1;
    int cnt = 0;
    int front = 0;


    foreach (i; 0..N) {
        if (S[i] == '(') {
            st[++p] = i;
        } else if (cnt < N - K) {
            cnt += 2;
            p -= 1;
        } else {
            st[++p] = i;
        }
    }

    foreach (i; 0..p+1) {
        write(S[st[i]]);
    }

    writeln;
}
