#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long int n, k, a[200005];
map<long long int, long long int> m;
map<long long int, long long int>::iterator it, itr, itl;
string s;
long long int f() {
  long long int l, r, mid, ans, x, y;
  it = m.begin();
  l = it->first;
  it = m.end();
  it--;
  r = it->first;
  mid = (r + l) / 2;
  if (m[mid] == 1) {
    ans = max(r - mid, mid - l);
  } else {
    it = m.find(mid);
    itr = next(it);
    itl = prev(it);
    x = itl->first;
    y = itr->first;
    ans = min(max(r - x, x - l), max(r - y, y - l));
    m.erase(mid);
  }
  return ans;
}
void solve() {
  long long int i, j, sum = 0, l, r, ans = 1e9;
  cin >> s;
  for (i = 0; i < n; i++) {
    if (s[i] == '0') {
      a[i] = 1;
    } else {
      a[i] = 0;
    }
  }
  l = 0;
  sum = 0;
  for (r = 0; r < n; r++) {
    sum += a[r];
    if (a[r] == 1) {
      m[r] = 1;
    }
    while (l < r && sum > k + 1) {
      if (a[l] == 1) {
        m.erase(l);
        sum--;
      }
      l++;
    }
    if (sum == k + 1) {
      ans = min(ans, f());
    }
  }
  printf("%I64d", ans);
  return;
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  solve();
  return 0;
}
