#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double eps = 1e-6;
const int maxn = 2e5 + 5;
int n, k;
int dp[maxn];
char a[maxn];
int res = 1e9 + 7;
void Solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i] = dp[i - 1] + (a[i] == '0');
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == '1') continue;
    int l = 0, r = n + 1;
    while (r - l > 1) {
      int mid = (l + r) >> 1;
      int L = max(1, i - mid);
      int R = min({L + 2 * mid, i + mid, n});
      int RR = min(n, i + mid);
      int LL = max({1, i - mid, RR - 2 * mid});
      if (dp[R] - dp[L - 1] > k || dp[RR] - dp[LL - 1] > k)
        r = mid;
      else
        l = mid;
    }
    res = min(res, r);
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  if (fopen(""
            ".inp",
            "r")) {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  int test_case = 1;
  while (test_case--) Solve();
  return 0;
}
