#include <bits/stdc++.h>
using namespace std;
int room[100010];
char s[100010];
int main() {
  int i, j, k, l;
  int a, c, b, n, m;
  while (~scanf("%d %d", &n, &k)) {
    scanf("%s", &s);
    room[0] = 0;
    for (i = 1; i <= n; i++) {
      m = s[i - 1] - '0';
      if (m)
        room[i] = room[i - 1];
      else
        room[i] = room[i - 1] + 1;
    }
    int le, ri, mark, mid, pos;
    int ans = 10e6;
    for (i = 1; i <= n; i++) {
      le = i;
      ri = n;
      mark = -1;
      if (room[i] == room[i - 1]) continue;
      while (le <= ri) {
        mid = (le + ri) / 2;
        if (room[mid] - room[i] >= k) {
          ri = mid - 1;
          mark = mid;
        } else
          le = mid + 1;
      }
      if (mark != -1) {
        l = mark - i + 1;
        int p1, p2;
        if (l % 2 == 0) {
          p1 = (mark + i) / 2;
          p2 = p1 + 1;
        } else
          p1 = p2 = (mark + i) / 2;
        while (1) {
          if (s[p1 - 1] == '0') {
            pos = p1;
            break;
          } else if (s[p2 - 1] == '0') {
            pos = p2;
            break;
          }
          p1--;
          p2++;
        }
        ans = min(ans, max(pos - i, mark - pos));
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
