#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> free(n);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      free[i] = 1;
    }
  }
  for (int i = 1; i < n; ++i) {
    free[i] += free[i - 1];
  }
  int ans = n + 10;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1') {
      continue;
    }
    int l = 0, r = n;
    while (l < r) {
      int m = (l + r) / 2;
      if (free[min(i + m, n - 1)] - (i - m - 1 >= 0 ? free[i - m - 1] : 0) >=
          k + 1) {
        r = m;
      } else {
        l = m + 1;
      }
    }
    ans = min(ans, l);
  }
  cout << ans << endl;
  return 0;
}
