#include <bits/stdc++.h>
using namespace std;
const int N = 212345, LG = 21, mod = 1000000007;
const double eps = 1e-3, pi = acos(-1.0);
int p[N], n, k;
string s;
bool f(int d) {
  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] == '1') continue;
    int l = max(i - d - 1, 0), r = min(i + d, n);
    if (p[r] - p[l] > k) return true;
  }
  return false;
}
int main() {
  scanf("%d", &n), scanf("%d", &k);
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    p[i + 1] = p[i] + ((s[i] - '0') ^ 1);
  }
  int lo = 1, hi = n - 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if (f(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  printf("%d\n", lo);
  return 0;
}
