#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100000 + 10, inf = 0x3f3f3f3f;
int n, k, cnt, ans = inf;
int a[Maxn];
int main() {
  scanf("%d%d", &n, &k);
  char s[Maxn];
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i)
    if (s[i] == '0') a[++cnt] = i;
  n = cnt;
  for (int i = 1; i + k <= n; ++i) {
    int l = i, r = i + k;
    int tmp = (a[l] + a[r]) >> 1;
    while (l < r) {
      int mid = (l + r) >> 1;
      ++mid;
      if (a[mid] <= tmp)
        l = mid;
      else
        r = mid - 1;
    }
    for (int j = min(l - 2, i); j <= min(l + 2, i + k); ++j)
      ans = min(ans, max(a[j] - a[i], a[i + k] - a[j]));
  }
  printf("%d\n", ans);
  return 0;
}
