#include <bits/stdc++.h>
using namespace std;
void run() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') v.push_back(i + 1);
  }
  auto iter = v.begin();
  int res = 1e9;
  for (int i = 0; i < v.size() - k; i++) {
    int mid = (v[i + k] + v[i]) / 2;
    auto left = upper_bound(iter, next(iter, k), mid);
    auto right = left--;
    int a = max(v[i + k] - *left, *left - v[i]);
    int b = max(v[i + k] - *right, *right - v[i]);
    res = min(res, min(a, b));
    iter++;
  }
  cout << res << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  run();
  return 0;
}
