#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100009;
char suf[MAXN];
int n, k, ansL, ansR;
int L[MAXN], R[MAXN];
bool Check(int now) {
  for (int i = 1; i <= n; i++)
    if (suf[i - 1] == '0') {
      int s = max(1, i - now);
      int t = min(n, i + now);
      if (L[t] - L[s - 1] >= k + 1) return true;
    }
  return false;
}
int main() {
  scanf("%d %d\n", &n, &k);
  gets(suf);
  L[0] = 0;
  for (int i = 1; i <= n; i++)
    if (suf[i - 1] == '0')
      L[i] = L[i - 1] + 1;
    else
      L[i] = L[i - 1];
  ansL = 1, ansR = n - 1;
  while (ansL < ansR) {
    int now = (ansL + ansR) / 2;
    if (Check(now))
      ansR = now;
    else
      ansL = now + 1;
  }
  cout << ansL << "\n";
}
