#include <bits/stdc++.h>
using namespace std;
char f[100010];
int sum[100010], n, k;
int check(int x) {
  for (int i = 1; i <= n; i++) {
    if (f[i] == '1') continue;
    int l = max(1, i - x), r = min(n, i + x);
    if (sum[i - 1] - sum[l - 1] + sum[r] - sum[i] >= k) return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> f[i];
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + (f[i] == '0');
  int left = 1, right = n;
  while (left < right) {
    int mid = (left + right) >> 1;
    if (!check(mid))
      left = mid + 1;
    else
      right = mid;
  }
  cout << left;
  return 0;
}
