#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100005;
int p[Maxn];
int n, k;
int a[Maxn];
int main() {
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    p[i + 1] = p[i] + (s[i] == '0');
  }
  int left = 0, right = n;
  while (right - left > 1) {
    bool good = false;
    int mid = (left + right) / 2;
    for (int i = 0; i < n; i++) {
      if (s[i] != '0') continue;
      int l = max(0, i - mid);
      int r = min(n - 1, i + mid) + 1;
      if (p[r] - p[l] >= k + 1) {
        good = true;
        break;
      }
    }
    if (good) {
      right = mid;
    } else {
      left = mid;
    }
  }
  cout << right << endl;
  return 0;
}
