#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int sz = 0;
  for (int i = 0; i < n; i++)
    if (s[i] == '0') sz++;
  vector<int> empty(sz);
  int idx = 0;
  for (int i = 0; i < n; i++)
    if (s[i] == '0') empty[idx++] = i;
  int i = 0, j = k;
  int ret = 1e9;
  while (j < sz) {
    int x = (empty[i] + empty[j]) / 2;
    vector<int>::iterator low = lower_bound(empty.begin(), empty.end(), x);
    low--;
    low--;
    for (int t = 0; t < 5; t++) {
      int cur = (*low);
      if (empty[i] <= cur && cur <= empty[j])
        ret = min(ret, max(cur - empty[i], empty[j] - cur));
      low++;
    }
    i++;
    j++;
  }
  cout << ret << endl;
  return 0;
}
