#include #include #include #define REP(i,n) for(int i=0;i> n >> k >> s; int at = 0; REP(i, n) at += s[i] - '0'; int wt = max(0, (k - 5000) / n); int res = max(0, wt * (n - at)); at = 0; k -= n * wt; while (k>0){ REP(i, n){ (at > 0) ? at-- : res++; --k; if (k < 1) break; at += s[i] - '0'; } } cout << res << endl; return 0; }