#include <bits/stdc++.h>
using namespace std;
int b[100005];
struct cs {
  int num;
  int x;
} c[3];
string s;
int left1, right1;
int tem;
int check(int m) {
  if (s[m] == '0') return m;
  int y = m;
  int x = m;
  while (s[x] != '0' && x < s.size()) x++;
  while (s[y] != '0' && y >= 0) y--;
  if (s[x] != '0') return y;
  if (s[y] != '0') return x;
  if (abs(m - y) < abs(m - x))
    return y;
  else
    return x;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  memset(b, 0, sizeof(b));
  int cnt = 0;
  cin >> s;
  for (unsigned int i = 0; i < s.size(); i++) {
    if (s[i] == '0') b[i] = ++cnt;
  }
  left1 = 0;
  right1 = 0;
  int ans = 0x3f3f3f3f;
  while (right1 < n) {
    while (s[left1] == '1') left1++;
    right1 = left1;
    while (b[right1] - b[left1] < k && right1 < n) {
      right1++;
    }
    if (right1 == n || (b[right1] - b[left1] < k)) break;
    tem = (left1 + right1) / 2;
    int pp = check(tem);
    int tem;
    tem = max(pp - left1, right1 - pp);
    if (tem < ans) ans = tem;
    left1++;
  }
  printf("%d\n", ans);
  return 0;
}
