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