#include <bits/stdc++.h>
size_t const MAXN = 100100;
char s[MAXN];
int p[MAXN];
inline int abs(int v) { return v < 0 ? -v : v; }
inline int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  scanf("%s", s);
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    if (s[i] == '0') p[cnt++] = i;
  int l = 0, r = k, c = 0, best = -1;
  while (r < cnt) {
    int cur = max(p[c] - p[l], p[r] - p[c]);
    while (c < r) {
      int t = max(p[c + 1] - p[l], p[r] - p[c + 1]);
      if (t > cur) break;
      ++c;
      cur = t;
    }
    if (best == -1 || cur < best) best = cur;
    ++l;
    ++r;
  }
  printf("%d", best);
  return 0;
}
