#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream &operator<<(ostream &O, pair<T1, T2> &t) {
  return O << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &O, vector<T> &t) {
  for (int _ = 0; _ < (int)t.size(); ++_) O << t[_] << " ";
  return O;
}
void dout() { cout << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cout << H << " ";
  dout(T...);
}
int nxt[100500], num = (2147483647);
bool step(int i, int mid, int j) {
  if (nxt[mid] > 100500) return false;
  int cur = ((mid - i) > (j - mid) ? (mid - i) : (j - mid));
  int nw = ((nxt[mid] - i) > (j - nxt[mid]) ? (nxt[mid] - i) : (j - nxt[mid]));
  return nw <= cur;
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  memset(nxt, 63, sizeof(nxt));
  for (int i = n - 1; i >= 0; --i) {
    nxt[i] = num;
    if (s[i] == '0') num = i;
  }
  int i = 0, j = -1, cnt = 0, mid = 0;
  int res = (2147483647);
  while (j < n) {
    if (cnt < k + 1) {
      j++;
      if (j < n && s[j] == '0') ++cnt;
    } else if (cnt > k + 1) {
      if (s[i] == '0') --cnt;
      ++i;
    } else {
      while (step(i, mid, j)) mid = nxt[mid];
      res = min(res, ((mid - i) > (j - mid) ? (mid - i) : (j - mid)));
      if (s[i] == '0') --cnt;
      i++;
    }
  }
  cout << res;
  return 0;
}
int cpp4cf_main() {
  freopen("C.cpp", "r", stdin);
  char s[99];
  bool f;
  while (true) {
    cin >> s;
    if (cin.eof()) break;
    if (strstr(s, "/*")) {
      cin >> s;
      if (strstr(s, "Test")) {
        cin >> s;
        if (strstr(s, "on")) {
          cout << "Output: ";
          cpp4cf_main();
          cout << "\nAnswer: ";
          f = false;
          while (true) {
            cin >> s;
            if (strstr(s, "*/")) break;
            if (strstr(s, "//")) {
              if (f)
                cout << endl;
              else
                f = true;
            } else
              cout << s << " ";
          }
          cout << "\n\n";
        }
      }
    }
  }
  return 0;
}
