#include <bits/stdc++.h>
int loc[100005];
int main() {
  int a, b, free = 0, start, end, i2, left, right, minn = 999999, i;
  char temp;
  scanf("%d %d", &a, &b);
  b++;
  for (i = 1; i <= a; i++) {
    scanf(" %c", &temp);
    if (temp == '0') loc[++free] = i;
  }
  for (i = b; i <= free; i++) {
    end = i + 1;
    start = i - b;
    for (i2 = (start + end) / 2; start + 1 != end; i2 = (start + end) / 2) {
      if (loc[i2] - (loc[i - b + 1]) < loc[i] - loc[i2])
        start = i2;
      else
        end = i2;
    }
    minn = std::min(
        minn, std::max(loc[start] - loc[(i - b + 1)], loc[i] - loc[start]));
    minn = std::min(minn,
                    std::max(loc[end] - loc[(i - b + 1)], loc[i] - loc[end]));
  }
  printf("%d", minn);
  return 0;
}
