#include <bits/stdc++.h>
int abs(int a) { return a < 0 ? -a : a; }
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  bool ar[100000];
  getchar();
  for (int i = 0; i < n; ++i) {
    ar[i] = getchar() - '0';
  }
  int mid = 0;
  int l = 0;
  int r = 0;
  int cnt = 0;
  int m = 1000001;
  if (k == 1) {
    int m = 1000001;
    int prev = -1000000;
    for (int i = 0; i < n; ++i) {
      if (!ar[i]) {
        m = min(m, abs(i - prev));
        prev = i;
      }
    }
    printf("%d\n", m);
    return 0;
  }
  while (cnt < k + 1) {
    if (!ar[r]) cnt++;
    r++;
  }
  r--;
  while (ar[l]) l++;
  mid = l;
  m = 1000000;
  for (;;) {
    int tmp = mid;
    int prev = 1000000;
    int cur;
    while (tmp <= r && (cur = max(abs(r - tmp), abs(l - tmp))) < prev) {
      mid = tmp;
      if (tmp == r) break;
      tmp++;
      while (ar[tmp]) tmp++;
      prev = cur;
    }
    m = min(m, prev);
    r++;
    while (r < n && ar[r]) r++;
    if (r == n) break;
    l++;
    while (ar[l]) l++;
  }
  printf("%d\n", m);
}
