#include <bits/stdc++.h>
using namespace std;
int a[101010];
int main() {
  int i, j, k;
  int n, m, z;
  string s;
  scanf("%d%d", &n, &k);
  cin >> s;
  vector<int> zeroes;
  for (i = 0; i < n; i++) {
    if (s[i] == '0') zeroes.push_back(i + 1);
  }
  int len, mn = 1e9;
  i = 0, j = k, z = 0;
  while (j < zeroes.size()) {
    while (max(zeroes[z] - zeroes[i], zeroes[j] - zeroes[z]) >
           max(zeroes[z + 1] - zeroes[i], zeroes[j] - zeroes[z + 1]))
      z++;
    m = max(zeroes[z] - zeroes[i], zeroes[j] - zeroes[z]);
    mn = min(mn, m);
    i++, j++;
  }
  printf("%d", mn);
  return 0;
}
