#include <bits/stdc++.h>
using namespace std;
char fre[100100];
vector<int> curplaces;
int dist(int x, int y) {
  if (y < x) swap(x, y);
  return y - x;
}
int fn(int s, int l, int r) { return max(dist(s, l), dist(s, r)); }
int find_best(int x, int y) {
  int l = 0;
  int r = (int)curplaces.size() - 1;
  while (r - l > 2) {
    int m1 = l + (r - l) / 3;
    int m2 = l + (r - l) / 3 * 2;
    if (fn(curplaces[m1], x, y) < fn(curplaces[m2], x, y))
      r = m2;
    else
      l = m1;
  }
  return min(min(fn(curplaces[l], x, y), fn(curplaces[r], x, y)),
             fn(curplaces[(l + r) / 2], x, y));
}
int main() {
  int n, k;
  cin >> n >> k;
  k++;
  scanf("%s", fre);
  int j = 0;
  int curnum = 0;
  int ans = 1000000;
  for (int i = 0; i < n; i++) {
    if (i > 0 && fre[i - 1] == '0') {
      curnum--;
      curplaces.erase(curplaces.begin());
    }
    while (j < n && curnum < k) {
      if (fre[j] == '0') {
        curplaces.push_back(j);
        curnum++;
      }
      j++;
    }
    if (curnum == k) {
      int res = find_best(i, j - 1);
      if (res < ans) ans = res;
    }
  }
  cout << ans;
  return 0;
}
