#include <bits/stdc++.h>
int n, k;
int p[100010];
char s[100010];
int max(int x, int y) { return x > y ? x : y; }
int min(int x, int y) { return x < y ? x : y; }
bool check(int i, int mid) {
  int b = max(i - mid, 1);
  int e = min(i + mid, n);
  if (p[e] - p[b - 1] - 1 >= k)
    return true;
  else
    return false;
}
int main() {
  int b, e, i, mid;
  while (~scanf("%d%d%*c", &n, &k)) {
    scanf("%s", s + 1);
    p[0] = 0;
    for (i = 1; i <= n; i++) {
      if (s[i] == '0')
        p[i] = p[i - 1] + 1;
      else
        p[i] = p[i - 1];
    }
    int ans = 100010;
    for (i = 1; i <= n; i++) {
      b = 1;
      e = n;
      if (s[i] == '1') continue;
      if (s[i] == '0') {
        while (b < e) {
          mid = (b + e) / 2;
          if (check(i, mid))
            e = mid;
          else
            b = mid + 1;
        }
      }
      ans = min(ans, e);
    }
    printf("%d\n", ans);
  }
  return 0;
}
