#include using namespace std; // #include // using namespace atcoder; // using mint = modint998244353; using ll = long long; #define fix(x) fixed << setprecision(x) #define rep(i, n) for(int i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n >> a >> s; ll m = 0, ex = 0, cnt = 0, tot = 0, ans = 0, z = 0; rep(i,n){ if(s[i]=='1'){ ++tot; if(m>=0) ++ex; else ++m, ++cnt; }else{ --m; } } while(a>0 && cnt