#include <bits/stdc++.h>
using namespace std;
const int NMAX = 100005;
int n, k;
char s[NMAX];
int sum[NMAX];
int get(int l, int r) {
  l = max(1, l);
  r = min(r, n);
  return sum[r] - sum[l - 1];
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> k;
  cin >> (s + 1);
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + (s[i] == '0');
  int ans = 1 << 30;
  for (int i = 1; i <= n; i++)
    if (s[i] == '0') {
      int l = 1;
      int r = n;
      int sol = -1;
      while (l <= r) {
        int mi = (l + r) / 2;
        if (get(i - mi, i - 1) + get(i + 1, i + mi) >= k) {
          sol = mi;
          r = mi - 1;
        } else
          l = mi + 1;
      }
      if (sol != -1) ans = min(ans, sol);
    }
  cout << ans;
  return 0;
}
