#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, k; cin >> n >> k;
  string s; cin >> s;
  vector<int> hoge = {0,1};
  char tmp = s.at(0);
  for (int i=1; i<n; i++) {
    if (s.at(i) == tmp) hoge.back()++;
    else {
      tmp = s.at(i);
      hoge.push_back(hoge.back()+1);
    }
  }
  if (s.at(0) == '0') hoge.insert(hoge.begin(), 0);
  if (s.back() == '0') hoge.push_back(hoge.back());

  int ans = 0;
  if (hoge.size() > 2*k+1) {
    for (int i=0; i<hoge.size()-(2*k+1); i+=2) ans = max(ans, hoge.at(i+2*k+1) - hoge.at(i));
  }
  else ans = hoge.back();
  cout << ans << endl;
}