#include <bits/stdc++.h>
using namespace std;
string str;
vector<int> a;
int n, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  cin >> str;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == '0') a.push_back(i + 1);
  }
  int res = 1e9;
  for (int i = 0; i + k < a.size(); i++) {
    int left = i - 1;
    int right = i + k + 1;
    int lk = (a[i] + a[i + k] + 1) / 2;
    while (left + 1 < right) {
      int mid = (left + right) / 2;
      if (a[mid] < lk) {
        left = mid;
      } else {
        right = mid;
      }
    }
    res = min(res, max(a[right] - a[i], a[i + k] - a[right]));
    if (k > 1)
      res = min(res, max(a[right - 1] - a[i], a[i + k] - a[right - 1]));
  }
  cout << res << "\n";
  return 0;
}
