#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3 * (1e5 + 10), BASE = 3137, MOD = 1e9 + 7, inf = 1000000009;
const double PI = 3.1415926535;
const int dx[] = {0, -1, 0, 1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int n, k;
char str[MAXN];
int sum[MAXN];
int sol = 10000005;
int GetSum(int a, int b) {
  if (a <= 0)
    return sum[b];
  else
    return sum[b] - sum[a - 1];
}
bool Moze(int pos, int dist) {
  int left = GetSum(pos - dist, pos);
  int right = GetSum(pos, pos + dist);
  if (str[pos] == '0') right--;
  return (left + right) >= (k + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  cin >> str;
  for (int i = 0; i < n; i++) {
    sum[i] = (str[i] == '0');
    if (i) sum[i] += sum[i - 1];
  }
  for (int i = n; i < 2 * n + 1; i++) sum[i] = sum[i - 1];
  for (int i = 0; i < n; i++) {
    if (str[i] == '1') continue;
    int lo = 1, hi = n;
    for (; lo < hi;) {
      int mid = (lo + hi) / 2;
      if (Moze(i, mid))
        hi = mid;
      else
        lo = mid + 1;
    }
    if (sol > hi) {
      sol = hi;
    }
  }
  cout << sol << endl;
  return 0;
}
