#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
bool IsEmpty(const vector<int>& pref, int pos) {
  return pos == 0 ? pref[0] : pref[pos] - pref[pos - 1];
}
int GetMaxCnt(const vector<int>& pref, int dist) {
  const int n = pref.size();
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (IsEmpty(pref, i)) {
      int l = max(i - dist, 0);
      int r = min(n - 1, i + dist);
      int cur = (l == 0 ? pref[r] : pref[r] - pref[l - 1]);
      res = max(cur, res);
    }
  }
  return res;
}
int main() {
  auto start = high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> pref(n, 0);
  pref[0] = (s[0] == '0');
  for (int i = 1; i < n; ++i) {
    pref[i] = pref[i - 1] + (s[i] == '0');
  }
  int l = 1;
  int r = s.length();
  while (l < r) {
    int m = (l + r) / 2;
    if (GetMaxCnt(pref, m) >= k + 1) {
      r = m;
    } else {
      l = m + 1;
    }
  }
  cout << l << endl;
  cerr << "Total execution time : "
       << duration_cast<milliseconds>(high_resolution_clock::now() - start)
              .count()
       << " ms" << endl;
  return 0;
}
