#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long n, s;
bool Can(long long m) {
  long long bs = m * 2 + 1;
  long long emptyR = 0;
  for (int i = 0; i < bs; i++) {
    emptyR += (a[i] == 0);
  }
  if (emptyR > s && a[bs / 2] != 1) {
    return true;
  }
  for (long long i = bs; i < a.size(); i++) {
    if (a[i] != a[i - bs]) {
      if (a[i] == 1) {
        emptyR--;
      }
      if (a[i] == 0) {
        emptyR++;
      }
    }
    if (a[i - bs / 2] == 1) {
      continue;
    }
    if (emptyR > s) {
      return true;
    }
  }
  return false;
}
int main() {
  cin >> n >> s;
  string str;
  cin >> str;
  a.resize(n, 1);
  for (int i = 0; i < n; i++) {
    a.push_back(str[i] - '0');
  }
  for (int i = 0; i < n; i++) {
    a.push_back(1);
  }
  long long l = 0, r = n - 1;
  while (r - l > 1) {
    long long m = (r + l) / 2;
    if (Can(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r;
  return 0;
}
