#include <bits/stdc++.h>
int max(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int a[n];
  k++;
  char s[2 * n];
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    a[i] = s[i] == '1';
  }
  int startedPos = 0, endPos = 0;
  int JohnPos = 0, JohnNextPos = 0;
  int bestAns = 1000000;
  int curK = 0;
  for (; curK < k; endPos++) {
    if (!a[endPos]) curK++;
  }
  endPos--;
  for (;; startedPos++, endPos++) {
    while (startedPos < n && a[startedPos]) startedPos++;
    while (endPos < n && a[endPos]) endPos++;
    if (endPos >= n) break;
    JohnNextPos = JohnPos + 1;
    while (JohnNextPos < n && a[JohnNextPos]) JohnNextPos++;
    while (max(JohnPos - startedPos, endPos - JohnPos) >
           max(JohnNextPos - startedPos, endPos - JohnNextPos)) {
      JohnPos = JohnNextPos;
      JohnNextPos++;
      while (JohnNextPos < n && a[JohnNextPos]) JohnNextPos++;
    }
    if (bestAns > max(JohnPos - startedPos, endPos - JohnPos))
      bestAns = max(JohnPos - startedPos, endPos - JohnPos);
  }
  printf("%d\n", bestAns);
  return 0;
}
