#include <bits/stdc++.h>
using namespace std;
int n, k, mn, ans = 1e9, arr[100100], ar[100100];
string s;
vector<int> v;
int main() {
  scanf("%d%d", &n, &k);
  cin >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == '0') v.push_back(i);
  v.push_back(1e6);
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (j != v.size() - 1)
      arr[i] = v[j];
    else
      arr[i] = v.size() - 1;
    if (i != v[j]) {
      if (!i)
        ar[i] = v.size() - 1;
      else
        ar[i] = ar[i - 1];
    } else if (j != v.size() - 1)
      ar[i] = v[j];
    else
      ar[i] = ar[i - 1];
    if (i == v[j] && j != v.size() - 1) j++;
  }
  for (int i = k; i < v.size() - 1; i++) {
    int cur, md = (v[i] + v[i - k]) / 2;
    if ((v[i] - v[i - k] + 1) % 2)
      cur = min(max(abs(v[i] - arr[md]), abs(arr[md] - v[i - k])),
                max(abs(v[i] - ar[md]), abs(ar[md] - v[i - k])));
    else {
      cur = min(max(abs(v[i] - arr[md]), abs(arr[md] - v[i - k])),
                max(abs(v[i] - ar[md]), abs(ar[md] - v[i - k])));
      md++;
      cur = min(cur, min(max(abs(v[i] - arr[md]), abs(arr[md] - v[i - k])),
                         max(abs(v[i] - ar[md]), abs(ar[md] - v[i - k]))));
    }
    ans = min(ans, cur);
  }
  printf("%d", ans);
  return 0;
}
