#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
deque<int> dq;
int chk(int idx) {
  if (idx < 0 or idx > k) return 1e9 + 7;
  return max(dq[idx] - dq[0], dq[k] - dq[idx]);
}
void solve() {
  cin >> n >> k;
  cin >> s;
  int ans = 1e9 + 7;
  long long int sum = 0;
  for (int i = 0, j = 0; i < n; i++) {
    while (j < n and (int) dq.size() < k + 1) {
      if (s[j] == '0') {
        sum += j;
        dq.push_back(j);
      }
      j++;
    }
    if ((int)dq.size() == k + 1) {
      int lo = 0;
      int hi = k;
      int mid1, mid2;
      while (lo <= hi) {
        mid1 = lo + hi >> 1;
        mid2 = mid1 + 1;
        if (chk(mid1) > chk(mid2)) {
          lo = mid1 + 1;
        } else {
          hi = mid1 - 1;
        }
      }
      ans = min(ans, min(chk(mid1), chk(mid2)));
    }
    if (s[i] == '0') {
      sum -= dq.front();
      dq.pop_front();
    }
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
