#include <bits/stdc++.h>
using namespace std;
int n, k;
char str[100000 + 5];
int cnt[100000 + 5];
int judge(int mid) {
  for (int i = 1; i <= n; i++) {
    if (str[i] == '1') continue;
    int left = max(1, i - mid);
    int right = min(n, i + mid);
    if (cnt[right] - cnt[left - 1] >= k + 1) {
      return 1;
    }
  }
  return 0;
}
void getcnt() {
  cnt[0] = 0;
  for (int i = 1; i <= n; i++) {
    cnt[i] = cnt[i - 1] + (str[i] == '0' ? 1 : 0);
  }
}
int solve() {
  int left = 1, right = n, ans;
  while (right >= left) {
    int mid = (left + right) >> 1;
    if (judge(mid)) {
      ans = mid;
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", str + 1);
  getcnt();
  printf("%d\n", solve());
  return 0;
}
