#include <bits/stdc++.h>
using namespace std;
char room[100010];
int n, k;
int empty_room[100010];
int count_room(int l, int r) {
  if (l < 0) return empty_room[r];
  if (r > n) return (empty_room[n] - empty_room[l]);
  return (empty_room[r] - empty_room[l]);
}
bool judge(int m) {
  for (int i = 1; i <= n; i++)
    if (room[i] == '0') {
      if (count_room(i - m - 1, i + m) >= (k + 1)) return 1;
    }
  return 0;
}
int main() {
  cin >> n >> k;
  getchar();
  scanf("%s", room + 1);
  empty_room[0] = 0;
  for (int i = 1; i <= n; i++)
    if (room[i] == '0')
      empty_room[i] = empty_room[i - 1] + 1;
    else
      empty_room[i] = empty_room[i - 1];
  int ans;
  int l = (k + 1) / 2, r = n;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (judge(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
