#include <bits/stdc++.h>
using namespace std;
int k, n;
int nxt[100005], lst[100005];
char s[100005];
void init() {
  scanf("%d%d%s", &n, &k, s + 1);
  nxt[n + 1] = -1;
  for (int i = n; i >= 1; i--) {
    if (s[i] == '0')
      nxt[i] = i;
    else
      nxt[i] = nxt[i + 1];
  }
  lst[0] = -1;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0')
      lst[i] = i;
    else
      lst[i] = lst[i - 1];
  }
}
void process() {
  if (k == 1) {
    int ans = 100000000;
    for (int i = 1; i <= n; i++) {
      if (nxt[i + 1] == -1) break;
      if (s[i] == '0') ans = min(nxt[i + 1] - i, ans);
    }
    printf("%d\n", ans);
    return;
  }
  int l = 1, md = 0, r = 1, ct = 0;
  ct = 0;
  while (1) {
    if (s[l] == '0') ct++;
    if (ct >= 1) break;
    l++;
  }
  ct = 0;
  while (1) {
    if (s[r] == '0') ct++;
    if (ct >= k + 1) break;
    r++;
  }
  md = (l + r) / 2;
  int ans = min(max(lst[md] - l, r - lst[md]), max(nxt[md] - l, r - nxt[md]));
  while (r < n) {
    l++, r++;
    while (r <= n && s[r] == '1') r++;
    while (l <= n && s[l] == '1') l++;
    if (r > n || l > n) break;
    md = (l + r) / 2;
    int tmp = min(max(lst[md] - l, r - lst[md]), max(nxt[md] - l, r - nxt[md]));
    ans = min(ans, tmp);
  }
  printf("%d\n", ans);
}
int main() {
  init();
  process();
  return 0;
}
