#include <bits/stdc++.h>
const double PI = acos(-1.0);
const double e = exp(1.0);
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using namespace std;
const int N = 1000005;
const int MAXN = 100100;
int n, m;
int a[MAXN];
char s[MAXN];
int check(int x) {
  int pos_l, pos_r;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '1') continue;
    pos_l = i - x - 1;
    pos_r = i + x;
    if (pos_l <= 0) pos_l = 0;
    if (pos_r > n) pos_r = n;
    if (a[pos_r] - a[pos_l] >= m + 1) return 1;
  }
  return 0;
}
int main() {
  scanf("%d %d", &n, &m);
  scanf("%s", s);
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1];
    if (s[i - 1] == '0') a[i]++;
  }
  int l = 1, r = n, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", l);
}
