#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') v.push_back(i + 1);
  }
  int l = 0, r = k, ans = 1e9;
  while (r < v.size()) {
    int mid = (v[r] - v[l]) / 2 + v[l];
    auto it = lower_bound(v.begin() + l, v.begin() + r + 1, mid);
    auto it2 = it - 1, it3 = it + 1;
    ans = min(ans, max(*it - v[l], v[r] - *it));
    if (it > v.begin() + l) ans = min(ans, max(*it2 - v[l], v[r] - *it2));
    if (it < v.begin() + r) ans = min(ans, max(*it3 - v[l], v[r] - *it3));
    l++, r++;
  }
  cout << ans << endl;
}
