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