#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  cin >> s;
  vector<int> e;
  for (int i = 0; i < n; i++)
    if (s[i] == '0') e.push_back(i);
  int l = 1;
  int r = n;
  while (l < r) {
    int mid = (l + r) / 2;
    int ll = 0;
    int rr = 0;
    int ok = 0;
    for (int i = 0; i < e.size(); i++) {
      while (e[i] - e[ll] > mid) ll++;
      while (rr + 1 < e.size() && e[rr + 1] - e[i] <= mid) rr++;
      if (rr - ll + 1 >= k + 1) {
        ok = 1;
        break;
      }
    }
    if (ok)
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
  return 0;
}
