#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int N, K; string S;
int main() {
  cin >> N >> K >> S;
  int t[100005];
  if(S[0] == '0') t[0] = 1;
  for(int i = 0; i < N; ++i) {
    if(S[i] == '1' && S[i+1] == '0') t[i+1] = t[i]+1;
    else t[i+1] = t[i];
  }
  int ans = 0;
  for(int i = 0; i < N; ++i) {
    int l = i, r = N;
    while(r-l > 1) {
      int m = (l+r)/2;
      int diff = t[m]-t[i];
      if(S[i] == '0') ++diff;
      if(diff > K) r = m;
      else l = m;
    }
    ans = max(ans, l-i+1);
  }
  cout << ans << endl;
}