#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') v.push_back(i);
  }
  n = v.size();
  int start = 0, endd = k, a = 0, f = 1e7;
  for (int i = start; i <= endd; i++) {
    int maxx = max(v[endd] - v[i], v[i] - v[start]);
    if (f > maxx) {
      f = maxx;
      a = i;
    }
  }
  while (endd < n - 1) {
    endd++;
    start++;
    for (int i = a; i <= endd; i++) {
      if (v[endd] - v[i] < v[i] - v[start]) {
        a = i;
        f = min(max(v[endd] - v[i], v[i] - v[start]), f);
        break;
      }
      int maxx = max(v[endd] - v[i], v[i] - v[start]);
      if (f > maxx) {
        f = maxx;
        a = i;
      }
    }
  }
  cout << f;
}
