#ifndef INCLUDED_MAIN #define INCLUDED_MAIN #include __FILE__ int main(){ ll n,k; cin>>n>>k; string s; cin>>s; if(n==1) { no(); return 0; } auto taio=[&](string &s) ->bool { int cnt=0; rep(i,(int)s.size()) { if(s[i]=='(') cnt++; else cnt--; if(cnt<0) return false; } if(cnt==0) return true; return false; }; if(!taio(s)) { no(); return 0; } ll score=calc_min(s); if(score>k) { no(); return 0; } else { string ans=""; int cur=0; rep(i,n) { if(s[i]=='(') { if(ans.size()>0) { if(ans.back()==')') ans+='+'; } ans+="(1+"; cur++; } else { if(ans.back()==')') { ans+=")"; } else { ans+="1)"; cur++; } } } while(score using namespace std; #define rep(i,n) for(ll i=0;i=l;i--) #define srep(i,l,r) for(ll i=l;i<=r;i++) using ll = long long; using ld = long double; const ll mod=998244353; #define vout(v) for(auto i :v) cout< #define vc vector int calc_min(string &s) { stack st; for(char c:s) { if(c=='(') { st.push(0); } else { int cur=st.top(); st.pop(); int score=(cur==0 ? 2 : cur+1); if(st.empty()) { st.push(score); } else { int prev=st.top(); st.pop(); st.push(prev+score); } } } return st.empty() ? 0:st.top(); } template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} void no() { cout<<"No"<& a) { ll ans=0; for(auto i:a) ans+=i; return ans; } ll modpow(ll fl, ll po, ll mode) { // mode: 0=modなし, 1=modあり ll ret=1; if (mode) { while (po>0) { if (po&1) ret=(ret*fl)%mod; fl=(fl*fl)%mod; po>>=1; } } else { while (po>0) { if(po&1) ret*=fl; fl*=fl; po>>=1; } } return ret; } #endif