#include <bits/stdc++.h>
using namespace std;
int64_t N, K;
char R[100010];
int main() {
  scanf("%lld%lld", &N, &K);
  ++K;
  scanf("%s", R);
  int count = 0;
  int l = 0, r = 0;
  for (int i = 0; i < N; ++i) {
    R[i] = '1' - R[i];
    if (R[i]) {
      if (count == 0) {
        l = i;
      }
      ++count;
      if (count == K) {
        r = i;
      }
    }
  }
  int ml = (r + l) / 2;
  int mr = (r + l + 1) / 2;
  int midl = ml;
  int midr = mr;
  while (midl >= 0 && !R[midl]) --midl;
  while (midr < N && !R[midr]) ++midr;
  int best = min(r - midl, midr - l);
  for (int i = 0; i < count - K; ++i) {
    int newl = l + 1, newr = r + 1;
    while (!R[newl]) ++newl;
    while (!R[newr]) ++newr;
    int nml = (newr + newl) / 2;
    int nmr = (newr + newl + 1) / 2;
    int nmidl = nml;
    int nmidr = nmr;
    if (nmidl >= midr) {
      while (nmidl > midr && !R[nmidl]) --nmidl;
    } else {
      nmidl = midl;
    }
    if (nmidr > midr) {
      while (nmidr < N && !R[nmidr]) ++nmidr;
    } else {
      nmidr = midr;
    }
    l = newl;
    r = newr;
    ml = nml;
    mr = nmr;
    midl = nmidl;
    midr = nmidr;
    int score = min(r - midl, midr - l);
    best = min(best, score);
  }
  printf("%d\n", best);
  return 0;
}
