#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int prefix[N];
int main() {
  string s;
  int n, k;
  cin >> n >> k >> s;
  for (int i = int(1); i <= int(n); i++)
    prefix[i] = prefix[i - 1] + '1' - s[i - 1];
  int ans = n + 1;
  for (int i = int(1); i <= int(n); i++) {
    if (s[i - 1] == '0') {
      int l = 0, r = n - 1;
      while (l + 1 < r) {
        int mid = (l + r) >> 1;
        int L = i - mid, R = i + mid;
        L = max(1, L), R = min(n, R);
        if (prefix[R] - prefix[L - 1] > k)
          r = mid;
        else
          l = mid;
      }
      ans = min(ans, r);
    }
  }
  cout << ans << endl;
  return 0;
}
