#include using namespace std; int main() { int n, k; cin>>n>>k; string s; cin>>s; int buy=0, win=0; auto done=[&]() { for(auto& c: s) { win==0 ? buy++ : win--; win+=c-'0'; k--; if (k==0) return true; } return false; }; while (k>0) { if (done()) break; if (win==0) { buy+=k/n*buy; k%=n; } int pwin=win, pbuy=buy; if (done()) break; if (pwin==win) { buy+=k/n*(buy-pbuy); k%=n; } } printf("%d\n", buy); }