#include #include #include #include #include using namespace std; int main() { int n, k; string s; cin >> n >> k >> s; int more = 0; for (int i = 0; i < n; i++) { more += s[i] - '0'; } int buy_per_box = n - more; if (buy_per_box < 0) { buy_per_box = 0; } int n_full = k / n; int limit = k % n + (n_full > 0) * n; int ans = 0; int hit = 0; for (int i = 0; i < limit; i++) { if (hit > 0) { hit--; } else { ans++; } hit += s[i % n] - '0'; } if (n_full > 0) { ans += buy_per_box * (n_full - 1); } cout << ans << endl; return 0; }