#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod) {
  x += y;
  if (x >= mod) x -= mod;
}
void et() {
  puts("-1");
  exit(0);
}
char s[100005];
int ps[100005];
bool ck(int mid) {
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    if (s[i] == '0') {
      int l = max(i - mid, 1), r = min(n, i + mid);
      if (ps[r] - ps[l - 1] >= k + 1) return 1;
    }
  return 0;
}
void fmain() {
  scanf("%d%d", &n, &k);
  scanf("%s", s + 1);
  for (int(i) = 1; (i) <= (int)(n); (i)++) ps[i] = ps[i - 1] + (s[i] == '0');
  int l = 0, r = n;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    if (ck(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%d\n", ck(l) ? l : r);
}
int main() {
  fmain();
  return 0;
}
