#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> v;
set<double> S;
set<double>::iterator it, it2;
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == '0') v.push_back(i + 1);
  int i = 0, j = 0;
  for (i = 0; i <= k; i++) S.insert(v[i]);
  j = i - 1;
  i = 0;
  int mn = INT_MAX;
  n = v.size();
  while (j < n) {
    double x = (v[i] + v[j]) / 2.0;
    it = S.lower_bound(x);
    it2 = it;
    it2--;
    int a = max(v[j] - *it, *it - v[i]);
    int b = max(*it2 - v[i], v[j] - *it2);
    mn = min(mn, min(a, b));
    j++;
    if (j < n) {
      S.erase(v[i]);
      S.insert(v[j]);
      i++;
    }
  }
  cout << mn;
  return 0;
}
