#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, x, y, z, cnt = 0, k, a, b, i, j, lo, hi, mid, flg, on = 1;
  string str;
  map<long long, long long> mp;
  long long frtf, dfubrgfgf;
  vector<long long> u, v, w;
  scanf("%lld %lld", &n, &k);
  cin >> str;
  for (i = 0; i < n; i++) {
    if (str[i] == '0') cnt++;
    mp[i + 1] = cnt;
  }
  lo = 1;
  hi = n - 1;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    flg = 0;
    for (i = 1; i <= n; i++) {
      if (str[i - 1] == '0') {
        y = max(on, i - mid);
        z = min(n, i + mid);
        x = mp[z] - mp[y - 1];
        if (x >= (k + 1)) {
          flg = 1;
          break;
        }
      }
    }
    if (flg == 1)
      hi = mid;
    else
      lo = mid + 1;
  }
  printf("%lld\n", lo);
  return 0;
}
