#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int, int>;
using vs = vector<string>;
using vpi = vector<pi>;
using ll = long long int;
template <typename T>
string tostr(T x) {
  ostringstream oss;
  oss << x;
  return oss.str();
}
template <typename T1, typename T2, typename T3>
T1 modpow(T1 a, T2 p, T3 mod) {
  T1 ret = 1;
  a %= mod;
  for (; p > 0; p /= 2) {
    if (p & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod;
  }
  return ret;
}
int dx[]{-1, 0, 1, 0, 1, 1, -1, -1};
int dy[]{0, -1, 0, 1, 1, -1, 1, -1};
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 10;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr int mx = 100005;
string rooms;
int n, k;
int psum[mx];
void pre() {
  int tot = 0;
  for (auto i = 0, _i = (n); i < _i; ++i) {
    tot += (rooms[i] == '0');
    psum[i] = tot;
  }
}
int get(int a, int b) {
  int ret = psum[b];
  if (a) ret -= psum[a - 1];
  return ret;
}
bool ok(int len) {
  for (auto i = 0, _i = (n); i < _i; ++i)
    if (rooms[i] == '0') {
      if (get(max(0, i - len), min(n - 1, i + len)) >= k + 1) {
        ;
        return true;
      }
    }
  return false;
}
int main() {
  cin >> n >> k >> rooms;
  pre();
  int lo = 0, hi = n;
  while (lo < hi) {
    int m = (lo + hi) / 2;
    if (ok(m))
      hi = m;
    else
      lo = m + 1;
  }
  cout << lo << endl;
  return 0;
}
