#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
int main() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == '0') v.push_back(i);
  long long int ans = 1e6;
  for (int i = 0; i < v.size() - k; i++) {
    long long int lo = i;
    long long int hi = i + k;
    long long int mi;
    long long int temp1 = lo;
    long long int temp2 = hi;
    while (lo <= hi) {
      mi = (lo + hi) / 2;
      if (v[mi] - v[temp1] <= v[temp2] - v[mi])
        lo = mi + 1;
      else
        hi = mi - 1;
      ans = min(ans, max(v[mi] - v[temp1], v[temp2] - v[mi]));
    }
  }
  cout << ans;
  return 0;
}
