#include <bits/stdc++.h>
using namespace std;
string s;
int next(int n) {
  do {
    n++;
  } while (s[n] == '1');
  return n;
}
int main() {
  int n, k, l = -1, r = -1, m = 0, ans = 1e9;
  cin >> n >> k >> s;
  l = next(l);
  r = next(r);
  for (int i = 0; i < k; i++) {
    r = next(r);
  }
  while (r < n) {
    int x = next(m);
    while (max(r - m, m - l) > max(r - x, x - l)) {
      m = x;
      x = next(m);
    }
    ans = min(ans, max(r - m, m - l));
    l = next(l);
    r = next(r);
  }
  cout << ans;
  return 0;
}
