#include #include #include using namespace std; int to_int(char tmp){ int integer; string t="";t+=tmp; istringstream to(t); to>>integer; return integer; } int main(){ int N,K; string str; cin >> N >>K; cin >> str; long long int counter=0; int hit=0; int i=0; while(K>0){ int tmp=to_int(str[i]); if(hit==0 )counter++; else hit--; hit+=tmp; K--; i=(i+1)%N; } cout << counter << endl; return 0; }