#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout.setf(ios_base::fixed);
  cout.precision(28);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (auto &x : v) {
    char c;
    cin >> c;
    x = 1 - (c - '0');
  }
  int L = -1, R = 1e9, M;
  while (R - L > 1) {
    M = (L + R) / 2;
    int x = 0, y = 0;
    for (int i = 1; i < min(n, M + 1); ++i) {
      y += v[i];
    }
    bool s = 0;
    for (int i = 0; i < n; ++i) {
      if (v[i] == 1 && x + y >= k) {
        s = 1;
        break;
      }
      if (i == n - 1) {
        break;
      }
      y -= v[i + 1];
      if (i + M + 1 < n) {
        y += v[i + M + 1];
      }
      x += v[i];
      if (i - M >= 0) {
        x -= v[i - M];
      }
    }
    if (s) {
      R = M;
    } else {
      L = M;
    }
  }
  cout << R;
  return 0;
}
