#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '0') v.push_back(i);
  }
  long long int mn = 1e9, m = 0;
  for (long long int i = 0; i + k < v.size(); i++) {
    long long int l = i;
    long long int r = i + k;
    while (max(v[m] - v[l], v[r] - v[m]) >
           max(v[m + 1] - v[l], v[r] - v[m + 1]))
      m++;
    mn = min(mn, max(v[m] - v[l], v[r] - v[m]));
  }
  cout << mn << '\n';
  return 0;
}
