#include <bits/stdc++.h>
using namespace std;
int n, k, ans = 1000000007;
int dp[100005], v[100005];
bool ok(int x) {
  for (int i = 1; i <= n; i++) {
    if (v[i] == 1) continue;
    int l = i - x - 1;
    int r = i + x;
    if (l < 1) l = 0;
    if (r > n) r = n;
    if (dp[r] - dp[l] > k) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%1d", &v[i]);
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (v[i] == 0) dp[i]++;
  }
  int h = 1, t = n, m;
  while (h <= t) {
    m = (h + t) / 2;
    if (ok(m)) {
      ans = min(ans, m);
      t = m - 1;
    } else
      h = m + 1;
  }
  printf("%d", ans);
}
