#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int a[maxn];
int d[maxn];
int f[maxn];
int n, k;
int check(int mid, int pos) {
  int l = max(1, pos - mid);
  int r = min(n, pos + mid);
  if (f[r] - f[l - 1] >= k) return 1;
  return 0;
}
int main() {
  scanf("%d%d", &n, &k);
  k++;
  int r = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%1d", &a[i]);
    if (a[i] == 0) {
      r++;
    }
    f[i] = r;
  }
  int j = 0;
  int m = 0;
  int Min = 1e9 + 1;
  int x, y;
  int ans = 1e9 + 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) continue;
    int l = 1, r = 1e9 + 1, mid;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (check(mid, i)) {
        r = mid - 1;
        ans = min(ans, mid);
      } else {
        l = mid + 1;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
