#include <bits/stdc++.h>
using namespace std;
char s[100005];
vector<int> vec;
int n, k, mn = INT_MAX;
int main() {
  scanf("%d%d%s", &n, &k, s);
  for (int i = 0; i < n; ++i)
    if (s[i] == '0') vec.push_back(i);
  for (int i = k; i < vec.size(); ++i) {
    int st = vec[i - k], en = vec[i];
    int idx1 = lower_bound(vec.begin(), vec.end(), (st + en) / 2) - vec.begin();
    int idx2 = idx1 - 1;
    int mx1 = max(en - vec[idx1], vec[idx1] - st);
    int mx2 = max(en - vec[idx2], vec[idx2] - st);
    mn = min(mn, min(mx1, mx2));
  }
  printf("%d", mn);
  return 0;
}
