#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100020;
char s[Maxn];
int a[Maxn];
int k, n;
bool check(int m) {
  for (int i = 1; i <= n; i++) {
    if (s[i] == '1') continue;
    if (a[i - 1] - a[max(0, i - m - 1)] + a[min(n, i + m)] - a[i] >= k)
      return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] + (s[i] == '0');
  int l = 1, r = n;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", l);
}
