#include <bits/stdc++.h>
using namespace std;
long long po(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % 1000000007;
    }
    a = (a * a) % 1000000007;
    b = b / 2;
  }
  return res % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> x;
    int pos = 0;
    int ans = 1e9;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') continue;
      x.push_back(i);
      if (x.size() > k) {
        int R = x[x.size() - 1];
        int L = x[x.size() - 1 - k];
        while (pos < x.size() - 1 && max(R - x[pos], x[pos] - L) >
                                         max(R - x[pos + 1], x[pos + 1] - L))
          pos++;
        ans = min(ans, max(R - x[pos], x[pos] - L));
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
