#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
char str[maxn];
int n, k, cnt[maxn];
int check(int x) {
  for (int i = 1; i <= n; i++) {
    if (str[i] == '1') continue;
    int l = max(1, i - x);
    int r = min(n, i + x);
    if (cnt[r] - cnt[l - 1] >= k + 1) return 1;
  }
  return 0;
}
int main() {
  cin >> n >> k;
  scanf(" %s", str + 1);
  for (int i = 1; i <= n; i++) {
    cnt[i] = cnt[i - 1];
    if (str[i] == '0') cnt[i]++;
  }
  int l = 1, r = n, mid, ans;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
