#include <bits/stdc++.h>
using namespace std;
int S[400005];
int pos[400005];
bool check(int n, string s, int k, int mid) {
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      int val = S[min(n, i + mid)] - S[max(0, i - mid - 1)];
      if (val >= k + 1) return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  assert(1 <= n && n <= 100000);
  assert(1 <= k && k <= 100000);
  string s;
  cin >> s;
  int emptyRoom = 0;
  s = " " + s;
  for (int i = 1; i <= n; i++) {
    S[i] = S[i - 1] + (s[i] == '0');
    if (s[i] == '0') {
      pos[S[i]] = i;
      emptyRoom++;
    }
  }
  assert(emptyRoom >= k + 1);
  int l = 0, r = n + 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(n, s, k, mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  cout << r + 1;
}
