#include <cstdio>
#include <algorithm>

int main()
{
  int n, k;
  char s[100001];
  scanf("%d%d%s", &n, &k, s);
  int blk[100001];
  int* dst = blk + 1;
  for (char *p = s; *p;)
  {
    char* q = p;
    while (*p && *p == *q) ++p;
    *dst++ = p - q;
  }
  int nblk = dst - (blk + 1);
  *blk = 0;
  for (int i = 1; i <= nblk; ++i)
  {
    blk[i] += blk[i - 1];
  }
  int ans = 0;
  if (*s == '0')
  {
    ans = blk[std::min(2 * k, nblk)];
  }
  for (int i = ('1' - *s); i < nblk; i += 2)
  {
    ans = std::max(ans, blk[std::min(i + 2 * k + 1, nblk)] - blk[i]);
  }
  printf("%d\n", ans);
  return 0;
}
