#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6 + 10;
int n, k, count1;
int a[MAX];
int res = 1e19 + 10;
int binary_search1(int x, int l, int r) {
  int res = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (a[mid] <= x) {
      res = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return res;
}
int binary_search2(int x, int l, int r) {
  int res = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (a[mid] < x) {
      l = mid + 1;
    } else {
      res = mid;
      r = mid - 1;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  scanf("%d %d\n", &n, &k);
  count1 = 0;
  for (int i = 1; i <= n; i++) {
    char s;
    scanf("%c", &s);
    if (s == '0') {
      a[++count1] = i;
    }
  }
  sort(a + 1, a + 1 + count1);
  k += 1;
  for (int i = 1; i <= count1 - k + 1; i++) {
    int l = i;
    int r = k + i - 1;
    int pos1 = binary_search1((a[l] + a[r]) >> 1, l, r);
    int pos2 = binary_search2((a[l] + a[r]) >> 1, l, r);
    if (pos1 != 0) {
      res = min(res, max(a[pos1] - a[l], a[r] - a[pos1]));
    }
    if (pos2 != 0) {
      res = min(res, max(a[pos2] - a[l], a[r] - a[pos2]));
    }
  }
  printf("%d", res);
  return 0;
}
