#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int a[n];
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      a[j] = i + 1;
      j++;
    } else
      a[n - i + j - 1] = -1;
  }
  int ans = 1e7;
  int t = 0;
  for (int i = 0; i < n - k; i++) {
    if (a[i + k] == -1) break;
    t = max(t, i);
    ans = min(max(a[i + k] - a[t], a[t] - a[i]), ans);
    while (t + 1 < i + k && max(a[i + k] - a[t], a[t] - a[i]) >=
                                max(a[i + k] - a[t + 1], a[t + 1] - a[i])) {
      ans = min(ans, max(a[i + k] - a[t + 1], a[t + 1] - a[i]));
      t += 1;
    }
  }
  cout << ans;
  return 0;
}
