#include <bits/stdc++.h>
using namespace std;
int n, k, a[100007], d[100007], lll[100007], rr[100007];
int find(int l, int r) {
  int ans = d[r];
  if (l != 0) ans -= d[l - 1];
  return ans;
}
int ask(int l, int r, int k) { return max(k - l, r - k); }
string ss;
void solve() {
  int i, j;
  scanf("%d%d", &n, &k);
  cin >> ss;
  for (i = 0; i < n; i++) {
    a[i] = ss[i] - '0';
    a[i] = 1 - a[i];
  }
  d[0] = a[0];
  for (i = 1; i < n; i++) {
    d[i] = d[i - 1] + a[i];
  }
  k++;
  int lst = -1e8;
  for (i = n - 1; i >= 0; i -= 1) {
    rr[i] = lst;
    if (a[i] == 1) lst = i;
  }
  int l = 0, r, m = 0, s = 0, ans = 1e9;
  for (r = 0; r < n; r++) {
    while (a[r] != 1) r++;
    s += a[r];
    while ((s == k && a[l] == 0) || s > k) {
      s -= a[l];
      l++;
    }
    if (m < l) m = rr[m];
    while (ask(l, r, rr[m]) < ask(l, r, m)) m = rr[m];
    if (s == k) ans = min(ans, ask(l, r, m));
  }
  printf("%d", ans);
}
int main() {
#pragma comment(linker, "/STACK:268435456"
  solve();
  return 0;
}
