#include <bits/stdc++.h>
using namespace std;
int cur[100010];
int main() {
  int n, k, i, j, ans;
  string s;
  cin >> n >> k >> s;
  ans = n;
  for (i = 1; i <= n; i++) {
    cur[i] = cur[i - 1] + ((s[i - 1] - 48) ^ 1);
  }
  for (i = 1; i <= n; i++) {
    if (s[i - 1] == '1') continue;
    int l = 0, r = max(n - i, i - 1);
    while (l < r) {
      int mid = (l + r) / 2;
      if (cur[min(n, i + mid)] - cur[max(1, i - mid) - 1] <= k)
        l = mid + 1;
      else
        r = mid;
    }
    if (cur[min(n, i + l)] - cur[max(1, i - l) - 1] > k) ans = min(ans, l);
  }
  cout << ans;
}
