#include <bits/stdc++.h>
int n, k, s, e, m, ans, temp, tp, tv;
bool m11, m22, first, b[100005], move;
char a[100005];
int dist() {
  if (m - s < e - m)
    return e - m;
  else
    return m - s;
}
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", a);
  for (e = 0; e < n; e++) {
    if (a[e] == '0') temp++;
    if (a[e] == '0' && !first) s = e, first = true;
    if (temp >= k + 1) break;
  }
  m = s;
  ans = dist();
  while (e < n) {
    tv = dist();
    tp = m;
    move = false;
    if (ans > dist()) {
      ans = dist();
    }
    while (m <= e) {
      m++;
      if (a[m] == '0') {
        if (tv > dist()) {
          tv = dist();
          tp = m;
          if (ans > dist()) {
            ans = dist();
          }
        } else {
          m = tp;
          break;
        }
      }
    }
    while (e < n) {
      e++;
      if (e < n && a[e] == '0') {
        while (true) {
          s++;
          if (a[s] == '0') {
            if (m < s) {
              m = s;
            }
            move = true;
            break;
          }
        }
      }
      if (move) break;
    }
  }
  printf("%d\n", ans);
  return 0;
}
