#include <bits/stdc++.h>
using namespace std;
const int MAX_MEM = 2e8;
char mem[MAX_MEM];
int mpos = 0;
void* operator new(size_t n) {
  char* ans = mem + mpos;
  mpos += n;
  return (void*)ans;
}
void operator delete(void*) {}
void precalc() {}
int n, k;
char s[100100];
bool a[100100];
vector<int> all_free;
int find_best(int l, int r) {
  int l_idx =
      lower_bound(all_free.begin(), all_free.end(), l) - all_free.begin();
  int r_idx =
      lower_bound(all_free.begin(), all_free.end(), r) - all_free.begin();
  int lb = l_idx, rb = r_idx - 1;
  int dist_r = r - l;
  while (lb != rb) {
    int mb = (lb + rb) / 2;
    int cur_dist = max(all_free[mb] - l, r - all_free[mb]);
    int next_dist = max(all_free[mb + 1] - l, r - all_free[mb + 1]);
    if (cur_dist < next_dist) {
      rb = mb;
    } else {
      lb = mb + 1;
    }
  }
  return min(dist_r, max(all_free[lb] - l, r - all_free[lb]));
}
int solve() {
  scanf("%d%d\n%s", &n, &k, &s);
  for (int i = 0; i < n; ++i) {
    a[i] = (s[i] == '1');
    if (!a[i]) {
      all_free.push_back(i);
    }
  }
  ++k;
  int cnt = 0, l = -1, r = -1, pos = 0;
  while (cnt < k) {
    if (a[pos]) {
      ++pos;
      continue;
    }
    ++cnt;
    if (l == -1) {
      l = pos;
    }
    r = pos;
    ++pos;
  }
  int ans = find_best(l, r);
  while (r < n - 1) {
    ++r;
    while (r < n && a[r]) {
      ++r;
    }
    if (r == n) {
      break;
    }
    ++l;
    while (l < n && a[l]) {
      ++l;
    }
    ans = min(ans, find_best(l, r));
  }
  printf("%d\n", ans);
  return 0;
}
int main() {
  precalc();
  int t;
  t = 1;
  for (int i = 1; i <= t; ++i) {
    solve();
  }
  return 0;
}
