#include <bits/stdc++.h>
using namespace std;
int n, k;
int sum[100000 + 20];
int check(int ans, int pos) {
  int left;
  int right;
  if (pos - ans < 0) {
    left = sum[pos - 1];
  } else
    left = sum[pos - 1] - sum[pos - ans - 1];
  if (pos + ans > n) {
    right = sum[n] - sum[pos];
  } else
    right = sum[pos + ans] - sum[pos];
  return left + right >= k;
}
void work() {
  scanf("%d%d", &n, &k);
  memset(sum, 0, sizeof(sum));
  char str[100000 + 20] = {0};
  scanf("%s", str + 1);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + (str[i] == '0');
  }
  int begin, end;
  int ans = 1 << 30;
  ;
  for (int i = 1; i <= n; i++) {
    if (str[i] == '0') {
      begin = 1;
      end = n + 2;
      while (begin <= end) {
        int mid = (((begin) > (end) ? (begin) : (end)) -
                   ((((begin) > (end) ? (begin) : (end)) -
                     ((begin) > (end) ? (end) : (begin))) >>
                    1));
        if (check(mid, i)) {
          ans = ((ans) > (mid) ? (mid) : (ans));
          end = mid - 1;
        } else
          begin = mid + 1;
      }
    }
  }
  printf("%d\n", ans);
  return;
}
int main() {
  work();
  return 0;
}
