#include <bits/stdc++.h>
using namespace std;
const int inf = 1.01e9;
const double eps = 1e-9;
const int N = 1e5 + 10;
char s[N];
int a[N];
int ac = 0;
int main() {
  int n, k;
  scanf("%d%d%s", &n, &k, s);
  for (int i = 0; (i) < (n); ++i)
    if (s[i] == '0') a[ac++] = i;
  int res = inf;
  for (int i = 0; i + k + 1 <= ac; ++i) {
    int l = a[i];
    int r = a[i + k];
    int m = (l + r + 1) >> 1;
    int pos = lower_bound(a + i, a + i + k + 1, m) - a;
    res = min(res, max(a[pos] - l, r - a[pos]));
    --pos;
    res = min(res, max(a[pos] - l, r - a[pos]));
  }
  printf("%d\n", res);
  return 0;
}
