#include <bits/stdc++.h>
using namespace std;
char ss[200000];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> A;
  scanf("%s", ss);
  for (int i = 0; i < n; i++)
    if (ss[i] == '0') A.push_back(i);
  int l = 0, r = 0, ans = -1;
  n = A.size();
  deque<int> K;
  k++;
  bool kk = 0;
  while (l < n) {
    while (r < n && K.size() < k) {
      K.push_back(A[r]);
      r++;
    }
    if (K.size() == k) {
      int md = K[k / 2], md1 = K[(k + 1 + (k % 2 == 0)) / 2];
      int res = -1;
      for (int i = k / 2, l = 0; i < k && l < 200; l++, i++)
        if (res == -1 || res > max(K[i] - K[0], K[k - 1] - K[i]))
          res = max(K[i] - K[0], K[k - 1] - K[i]);
      for (int i = k / 2, l = 0; i >= 0 && l < 200; i--, l++)
        if (res == -1 || res > max(K[i] - K[0], K[k - 1] - K[i]))
          res = max(K[i] - K[0], K[k - 1] - K[i]);
      if (ans == -1 || res < ans) ans = res;
    }
    K.pop_front();
    l++;
  }
  printf("%d\n", ans);
}
