#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
char s[111111];
int l, r, mi;
void upd(int &a, int b) {
  if (a > b) a = b;
}
int main() {
  scanf("%d%d%s", &n, &m, s);
  ans = n;
  l = 0;
  while (s[l] == '1') l++;
  r = l;
  while (m) {
    r++;
    while (s[r] == '1') r++;
    m--;
  }
  mi = l;
  while (r < n) {
    if (mi < l) mi = l;
    upd(ans, max(mi - l, r - mi));
    while (mi * 2 < l + r) {
      mi++;
      while (s[mi] == '1') mi++;
      upd(ans, max(mi - l, r - mi));
    }
    l++;
    while (s[l] == '1') l++;
    r++;
    while (r < n && s[r] == '1') r++;
  }
  printf("%d\n", ans);
  return 0;
}
