#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)1e5 + 10;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
int n, k;
char s[maxN];
int best = INF;
int cnt[maxN];
int sum(int l, int r) {
  l = max(1, l);
  r = min(n, r);
  return cnt[r] - cnt[l - 1];
}
bool can(int len) {
  for (int i = 1; i <= n; ++i) {
    if (s[i] == '0' && sum(i - len, i - 1) + sum(i + 1, i + len) >= k) {
      return true;
    }
  }
  return false;
}
int main() {
  n = nextInt<int>();
  k = nextInt<int>();
  gets(s + 1);
  for (int i = 1; i <= n; ++i) {
    cnt[i] = cnt[i - 1] + (s[i] == '0' ? 1 : 0);
  }
  int l = 1, r = n;
  for (int iter = 0; iter < 22; ++iter) {
    int mid = (l + r) / 2;
    if (can(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  for (int i = max(0, l - 2);; ++i) {
    if (can(i)) {
      cout << i << '\n';
      return 0;
    }
  }
  return 0;
}
