#include <bits/stdc++.h>
const int N = 1e5 + 100;
int n, k;
int sum[N];
char s[N];
int getsum(int l, int r) {
  if (l == 0) {
    return sum[r];
  }
  return sum[r] - sum[l - 1];
}
bool can(int d) {
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      int v = i + d;
      int u = i - d;
      if (v >= n) {
        v = n - 1;
      }
      if (u < 0) {
        u = 0;
      }
      if (getsum(u, v) >= k + 1) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  std::cin >> n >> k;
  std::cin >> s;
  sum[0] = (s[0] == '0');
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + (s[i] == '0');
  }
  int lf = 1, rg = n;
  while (rg - lf > 1) {
    int mid = (lf + rg) / 2;
    if (can(mid)) {
      rg = mid;
    } else {
      lf = mid + 1;
    }
  }
  if (can(lf)) {
    std::cout << lf << "\n";
  } else {
    std::cout << rg << "\n";
  }
  return 0;
}
