#include using namespace std; #define ALL(x) (x).begin(),(x).end() #define IO ios::sync_with_stdio(false),cin.tie(nullptr); #define REP(i, n) for(ll i=0; i<(ll)(n); i++) #define FOR(i, a, b) for(ll i=(ll)(a); (a)<(b) ? i<(b) : i>(b); i+=((a)<(b) ? 1 : -1)) template int LB(vector v, T x) { return lower_bound(ALL(v),x)-(v).begin(); } template int UQ(T& v) { sort(ALL(v)); v.erase(unique(ALL(v)),v.end()); return v.size(); } template bool chmax(T &a, T b) { return a bool chmin(T &a, T b) { return a>b ? a=b, true : false; } template using rpriority_queue=priority_queue,greater>; using ll=long long; const int INF=1e9+10; const ll INFL=4e18; using ld=long double; using ull=unsigned long long; using lll=__int128_t; using VI=vector; using VVI=vector; using VL=vector; using VVL=vector; using PL=pair; using VP=vector; using WG=vector>>; #ifdef LOCAL #include "./debug.hpp" #else #define debug(...) #define print_line #endif //---------------------------------------------------------- bool IsValidBrackets(string s) { int tmp=0; for(char c:s) { if(c=='(') tmp++; else tmp--; if(tmp<0) return false; } return tmp==0; } VVI MakeTreeFromBrackets(string s) { s="("+s+")"; int n=s.size()/2; int idx=-1; VVI ret(n); auto dfs=[&](auto&&dfs, int &pos)-> int { pos++; idx++; int now=idx; while(s[pos]!=')') ret[now].push_back(dfs(dfs,pos)); pos++; return now; }; int pos=0; dfs(dfs,pos); return ret; } int main() { int N,K; cin>>N>>K; string S; cin>>S; if(!IsValidBrackets(S)) { cout<<"No"< void { if(now!=0) ans+="("; for(int nxt:g[now]) { dfs(dfs,nxt); ans+="+"; } if(g[now].size()) ans.pop_back(); if(g[now].size()==0) { tmp+=2; ans+="1+1"; } if(g[now].size()==1) { tmp++; ans+="+1"; } if(now!=0) ans+=")"; return; }; dfs(dfs,0); if(tmp>K) { cout<<"No"<