#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string fir;
  cin >> fir;
  vector<long long> v;
  for (long long i = 0; i < fir.size(); ++i) {
    if (fir[i] == '0') {
      v.push_back(i);
    }
  }
  long long ans = pow(10, 7);
  long long m = 0;
  for (long long l = 0; l < v.size() - k; ++l) {
    long long r = l + k;
    ;
    while (v[m] - v[l] < v[r] - v[m]) {
      ++m;
    }
    ans = min(ans, max(v[m] - v[l], v[r] - v[m]));
    ans = min(ans, max(v[m - 1] - v[l], v[r] - v[m - 1]));
  }
  cout << ans << endl;
}
