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