#include <bits/stdc++.h>
using namespace std;
vector<int> v;
string s;
int main() {
  int n, k, l, h, m = 0, Min = 2147483647;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; s[i]; i++) {
    if (s[i] == '0') v.push_back(i);
  }
  for (int i = 0; i < v.size(); i++) {
    if (i + k < v.size()) {
      h = i + k;
      while (max(v[m] - v[i], v[h] - v[m]) >
             max(v[m + 1] - v[i], v[h] - v[m + 1]))
        m++;
      Min = min(Min, max(v[m] - v[i], v[h] - v[m]));
    }
  }
  cout << Min << endl;
}
