#include <bits/stdc++.h> 
using namespace std;
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; /*long long int は64bit*/
using vi = vector<int>;using Vi = vector<long long int>;using matrix = vector<vector<ll> >;using Pair = pair<ll,ll>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(long long int i=0;i<N;i++) 
#define rev(i,N) for(long long int i=N-1;i>=0;i--) /*N-1からスタート*/
#define np nullptr
template<class T,class T2>bool chmax(T &former, const T2 &b) { if (former<=b) { former=b; return true; } return false; }
template<class T,class T2>bool chmin(T &former, const T2 &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; } /*sqrt(x)は平方根*/
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) /*降順↓でVをソート*/
#define fill(x,num) memset(x,num,sizeof(x));
template<class T1,class T2>bool p_compare(const pair<T1,T2> fir,const pair<T1,T2> sec){ return fir.second < sec.second; }
bool p_comp(const Pair fir,const Pair sec){return p_compare<ll,ll>(fir,sec);}
template<class T1,class T2>bool pcompare(pair<T1,T2> fir,pair<T1,T2> sec){ return !p_comp(fir,sec); }
bool pcomp(const Pair fir,const Pair sec){return pcompare<ll,ll>(fir,sec);}
/*sort(all(v),p_compare<ll,ll> 又は p_comp)で↑ソート , pcompは↓ソート*/

//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////
//Snipet -> Caps Lock

ll n,k;
string s,s2;
vector<Pair> v;vector<Pair> vv;
vector<Pair> vv2,v2;


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n>>k>>s;s2 = s;
    ll tmp = 0,ans = 0;ll begin,end;
    rep(i,n){
        if(s[i]=='0'){
            if(tmp==0)begin = i;
            tmp++;
        }else{
            if(tmp!=0)end = i-1;
            if(tmp!=0)vv.pb(mp(begin,end));
            if(tmp!=0)v.pb(mp(tmp,vv.size()-1));tmp = 0;
        }
    }
    if(tmp!=0){
            end = n-1;
            vv.pb(mp(begin,end));
            v.pb(mp(tmp,vv.size()-1));tmp = 0;
    }
    tmp=0;
    //if(v.size()!=0)Sort(v);
    if(v.size()==0){
        cout<<n<<endl;
        return 0;
    }
    ll bbgi,eend;
    for(int i = 0;i+k<=s.size() && i<v.size();i++){
        bbgi = vv[v[i].second].first; eend = vv[v[min(i+k,(ll)v.size())-1].second].second;
        for(int l = bbgi-1;l>=0;l--){
            if(s[l]=='1'){
                bbgi=l;
            }else{
                break;
            }
        }
        for(int l = eend+1;l<s.size();l++){
            if(s[l]=='1'){
                eend =l;
            }else{
                break;
            }
        }
        // for(int l=i;l<i+k && l<v.size();l++){
        //     for(int j = vv[v[l].second].first;j<=vv[v[l].second].second;j++){
        //         s[j]='1';
        //     }
        // }
        tmp = eend - bbgi +1;
        // rep(i,s.size()){
        //     if(s[i]=='1')tmp++;
        //     else{
        //         chmax(ans,tmp);
        //         tmp = 0;
        //     }
        // }
        chmax(ans,tmp);
        s = s2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2280