#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  k++;
  cin >> s;
  int j = -1, c = 0, i = 0, l = 0;
  int ans = 1e9;
  int arr[100009] = {0};
  for (int f = 0; f < n; f++) {
    if (f && s[f - 1] == '0') c--;
    while (j + 1 < n && c < k) {
      j++;
      if (s[j] == '0') {
        c++;
        arr[l] = j;
        l++;
      }
    }
    if (c < k) break;
    while (i + 1 < l &&
           max(j - arr[i], arr[i] - f) > max(j - arr[i + 1], arr[i + 1] - f)) {
      i++;
    }
    ans = min(ans, max(j - arr[i], arr[i] - f));
  }
  cout << ans << endl;
}
