#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int h[N];
int n, k;
int Max(int a, int b) { return a > b ? a : b; }
int Min(int a, int b) { return a < b ? a : b; }
int erfen(int shu, int s, int e) {
  if (s == e - 1 || s == e) return s;
  int mid = (s + e) / 2;
  if (shu == h[mid]) return mid;
  if (shu <= h[mid])
    return erfen(shu, s, mid);
  else
    return erfen(shu, mid + 1, e);
}
int suan(int shu, int s, int e) {
  int x = erfen(shu, s, e);
  int ma = Max(h[e] - h[x], h[x] - h[s]);
  int mb = Max(h[e] - h[x + 1], h[x + 1] - h[s]);
  int mc = Max(h[e] - h[x - 1], h[x - 1] - h[s]);
  if (x + 1 <= e && x - 1 >= s) {
    return Min(Min(ma, mb), mc);
  }
  if (x + 1 > e) return Min(ma, mc);
  if (x - 1 < s) return Min(ma, mb);
  return ma;
}
int main() {
  scanf("%d %d", &n, &k);
  char ch;
  int t, s, e, x = 1, ss, ee;
  int ans = N;
  int min = N;
  getchar();
  for (int i = 1; i <= n; i++) {
    scanf("%c", &ch);
    t = ch - '0';
    if (t == 0) {
      h[x] = i;
      x++;
    }
  }
  x--;
  s = 1, e = s + k;
  for (; e <= x; s++, e++) {
    int mid = (h[s] + h[e]) / 2;
    ans = Min(ans, suan(mid, s, e));
    int mid2 = mid + 1;
    ans = Min(ans, suan(mid2, s, e));
  }
  printf("%d\n", ans);
}
