#include <bits/stdc++.h>
using namespace std;
int prv[100010], nxt[100010];
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int closest = -1;
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '0') {
      closest = i;
    }
    prv[i] = closest;
  }
  closest = n;
  for (int i = s.length() - 1; i >= 0; --i) {
    if (s[i] == '0') {
      closest = i;
    }
    nxt[i] = closest;
  }
  int p1 = 0, p2 = 0;
  int sum = 0;
  int ans = n;
  for (p1 = 0; p1 < s.length(); ++p1) {
    while (sum < k + 1 && p2 < s.length()) {
      sum += (s[p2] == '0' ? 1 : 0);
      ++p2;
    }
    if (sum == k + 1) {
      int pos = p1 + (p2 - p1) / 2;
      if (nxt[pos] != n) {
        ans = min(ans, max(nxt[pos] - p1, p2 - 1 - nxt[pos]));
      }
      if (prv[pos] != -1) {
        ans = min(ans, max(prv[pos] - p1, p2 - 1 - prv[pos]));
      }
    }
    sum -= (s[p1] == '0' ? 1 : 0);
  }
  cout << ans;
}
