#include <bits/stdc++.h>
int sum[100007], n, k;
std::string str;
int get_sum(int l, int r) { return l ? sum[r] - sum[l - 1] : sum[r]; }
int check(int len) {
  for (int i = 0; i < n; i++) {
    if (str[i] == '1') continue;
    int l = std::max(0, i - len);
    int r = std::min(n - 1, i + len);
    if (get_sum(l, r) >= k + 1) return 1;
  }
  return 0;
}
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin >> n >> k;
  std::cin >> str;
  sum[0] = !!(str[0] == '0');
  for (int i = 1; i < n; i++) sum[i] = sum[i - 1] + !!(str[i] == '0');
  int l = 0, r = n + 1, m;
  while (r - l > 1) {
    m = (l + r) >> 1;
    if (!check(m))
      l = m;
    else
      r = m;
  }
  std::cout << l + 1 << std::endl;
  return 0;
}
