#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int sum[100005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    arr[i] = (c == '0');
  }
  sum[0] = arr[0];
  for (int i = 1; i < n; i++) sum[i] = sum[i - 1] + arr[i];
  int ans = 1e9;
  for (int i = 0; i < n; i++) {
    if (!arr[i]) continue;
    int l = 0, r = n;
    while (r - l > 1) {
      int m = (r + l) / 2;
      int s = (sum[i] - (i - m - 1 >= 0 ? sum[i - m - 1] : 0)) +
              (sum[min(n - 1, i + m)] - sum[i]);
      if (s >= k + 1)
        r = m;
      else
        l = m;
    }
    ans = min(ans, r);
  }
  cout << ans << endl;
  return 0;
}
