#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
int gonext(int x) {
  x++;
  while (x < n && s[x] == '1') x++;
  return x;
}
int main() {
  cin >> n >> k;
  cin >> s;
  int ct = 0;
  int i = 0, f = 0, pos, d = INT_MAX, bo = 0;
  for (int j = 0; j < s.length(); ++j) {
    if (s[j] == '0') ct++;
    if (ct == 1 && bo == 0) {
      f = j;
      bo = 1;
    }
    if (ct == k + 1) {
      i = j;
      break;
    }
  }
  for (int j = f; j < i + 1; ++j) {
    if (max(j - f, i - j) < d && s[j] == '0') {
      d = min(d, max(j - f, i - j)), pos = j;
    }
  }
  int rp = i, lp = f;
  while (rp < n) {
    while (max(rp - pos, pos - lp) > max(rp - gonext(pos), gonext(pos) - lp))
      pos = gonext(pos);
    if (rp > n - 1) break;
    d = min(d, max(rp - pos, pos - lp));
    rp = gonext(rp);
    lp = gonext(lp);
  }
  cout << d << endl;
}
