#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 200;
int qianzhui[maxn];
int n, k;
char a[maxn];
bool check(int x) {
  int L, R;
  for (int i = 1; i <= n; i++) {
    if (a[i] == '1') continue;
    L = max(i - x, 1);
    R = min(i + x, n);
    if (qianzhui[R] - qianzhui[L - 1] >= k + 1) {
      return true;
    }
  }
  return false;
}
int main() {
  int i;
  scanf("%d%d", &n, &k);
  scanf("%s", a + 1);
  for (i = 1; i <= n; i++) {
    qianzhui[i] = qianzhui[i - 1] + (a[i] == '0');
  }
  int left = 0, right = n, mid;
  while (right - left > 1) {
    mid = (left + right) >> 1;
    if (check(mid))
      right = mid;
    else
      left = mid;
  }
  cout << right << endl;
  return 0;
}
