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