#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:5000000000")
const long long mod = 1000000007;
long long Inf = (long long)2e9;
long long LINF = (long long)1e18 + 1e17;
using namespace std;
vector<int> cnt;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  cnt.resize(n + 1);
  for (int i = 0; i < s.length(); i++) {
    cnt[i + 1] = cnt[i];
    if (s[i] == '0') cnt[i + 1]++;
  }
  s = '1' + s;
  int ans = n;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '1') continue;
    int r = n, l = 0;
    while (r - l > 1) {
      int m = (r + l) / 2;
      int left = max(0, i - m - 1);
      int right = min(n, i + m);
      if (cnt[right] - cnt[left] >= k + 1)
        r = m;
      else
        l = m;
    }
    ans = min(ans, r);
  }
  cout << ans;
  return 0;
}
