#include using namespace std; signed main(){ int N, K; cin >> N >> K; string S; cin >> S; vector< int > vis( N ); for( int i = 0, c = 0, b = 0, e = 0; ; i = ( i + 1 ) % N ){ if( vis[ i ] ){ vector< int > vis2( N ); for( int j = i, x = 0, y = 0, z = 0; ; j = ( j + 1 ) % N ){ if( vis2[ j ] ){ b += ( K - z ) / z * y; e += ( K - z ) / z * z; break; } vis2[ j ] = 1; if( e + z >= K ) cout << b + y << endl, exit( 0 ); ++y, ++z, x += S[ j ] - '0'; for( int k = ( j + 1 ) % N; ; k = ( k + 1 ) % N ){ if( x == 0 ){ j = k - 1; break; } if( j == k ) cout << b + y << endl, exit( 0 ); --x; x += S[ k ] - '0'; ++z; } } } vis[ i ] = 1; if( e >= K ) cout << b << endl, exit( 0 ); ++b, ++e, c += S[ i ] - '0'; for( int j = ( i + 1 ) % N; ; j = ( j + 1 ) % N ){ if( c == 0 ){ i = j - 1; break; } if( i == j ) cout << b << endl, exit( 0 ); --c; c += S[ j ] - '0'; ++e; } if( e >= K ) cout << b << endl, exit( 0 ); } return 0; }