#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
char s[MAXN];
int sum[MAXN];
int main() {
  int n, k;
  scanf("%d%d\n", &n, &k);
  gets(s);
  for (int i = 0; (i) < (n); ++i) sum[i + 1] = sum[i] + (s[i] == '0');
  int l = 0, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    bool ok = 0;
    for (int i = 0; (i) < (n); ++i) {
      int rr = sum[i + m + 1];
      if (i + m + 1 > n) rr = sum[n];
      int ll = 0;
      if (i >= m) ll = sum[i - m];
      if (s[i] == '0' && rr - ll >= k + 1) ok = 1;
    }
    if (ok)
      r = m;
    else
      l = m;
  }
  printf("%d\n", r);
  return 0;
}
