#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1.01e9;
const long double EPS = 1e-9;
const long double PI = acos(-1.0L);
void precalc() {}
const int maxn = (int)1e5 + 10;
char s[maxn];
int n, k;
bool read() {
  if (scanf("%d%d", &n, &k) < 2) {
    return 0;
  }
  scanf("%s", s);
  return 1;
}
void solve() {
  vector<int> a;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      a.push_back(i);
    }
  }
  ++k;
  int res = INF;
  for (int i = 0, j = 0; i + k <= ((int)(a).size()); ++i) {
    int x1 = a[i], x2 = a[i + k - 1];
    while (j + 1 < ((int)(a).size()) && a[j + 1] - x1 < x2 - a[j + 1]) {
      ++j;
    }
    for (int it = 0; it < 2; ++it) {
      int mid = j + it;
      if (mid >= ((int)(a).size())) {
        break;
      }
      res = min(res, max(a[mid] - x1, x2 - a[mid]));
    }
  }
  printf("%d\n", res);
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
