#include <bits/stdc++.h>
using namespace std;
bool check(vector<long long> &ps, const long long &n, const long long &k,
           long long x) {
  for (long long i = 0; i < n; i++) {
    if (ps[i] - (i > 0 ? ps[i - 1] : 0) == 0) continue;
    long long l = max(0ll, i - x), r = min(n - 1, i + x);
    long long sum = ps[r] - (l > 0 ? ps[l - 1] : 0ll);
    if (sum >= k + 1) return true;
  }
  return false;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> ps(n, (s[0] == '0'));
  for (int i = 1; i < n; i++) ps[i] = ps[i - 1] + (s[i] == '0');
  long long l = 0, r = n;
  while (r - l > 1) {
    long long m = l + (r - l) / 2;
    if (check(ps, n, k, m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r;
}
int main() {
  solve();
  return 0;
}
