#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long val[100005];
long long lParent[100005];
long long rParent[100005];
int main() {
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (i) {
      if (s[i] == '0')
        val[i] = val[i - 1] + 1;
      else
        val[i] = val[i - 1];
    } else {
      if (s[i] == '0')
        val[i] = 1;
      else
        val[i] = 0;
    }
  }
  if (val[0] == '1') {
    lParent[0] = -1;
  } else
    lParent[0] = 0;
  for (int i = 1; i < n; i++) {
    if (val[i] == val[i - 1]) {
      lParent[i] = lParent[i - 1];
    } else
      lParent[i] = i;
  }
  if (val[n - 1] == '1') {
    rParent[n - 1] = -1;
  } else
    rParent[n - 1] = n - 1;
  for (long long i = n - 2; i >= 0; i--) {
    if (s[i] == '1')
      rParent[i] = rParent[i + 1];
    else
      rParent[i] = i;
  }
  long long res = n + 1;
  for (int i = 0; i < n; i++) {
    if (val[i] == 0 || (s[i] == '1')) continue;
    long long ind = lower_bound(val, val + n, k + val[i]) - val;
    if (ind >= n) break;
    long long mid = (i + ind) / 2;
    long long ldist = max(lParent[mid] - i, ind - lParent[mid]);
    long long rdist = max(rParent[mid] - i, ind - rParent[mid]);
    long long dist = min(ldist, rdist);
    res = min(res, dist);
  }
  cout << res << endl;
  return 0;
}
