#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  string s;
  cin >> n >> k >> s;
  vector<int> a;
  for (int _n(n), i(0); i < _n; i++)
    if (s[i] != '1') a.push_back(i);
  int ans = 1011111111;
  for (int left = 0, mid = 0; left + k + 1 <= a.size(); ++left) {
    while (a[mid + 1] - a[left] <= a[left + k] - a[mid + 1]) ++mid;
    ans = min(ans, max(a[mid] - a[left], a[left + k] - a[mid]));
    ans = min(ans, max(a[mid + 1] - a[left], a[left + k] - a[mid + 1]));
  }
  cout << ans << endl;
  return 0;
}
