#include <bits/stdc++.h>
using namespace std;
int n, k, m;
char c;
vector<int> v;
int search(int l, int r, int ll, int rr) {
  while (r - l >= 3) {
    int m1 = l + (r - l) / 3;
    int m2 = r - (r - l) / 3;
    if (max(abs(ll - v[m1]), abs(rr - v[m1])) >
        max(abs(ll - v[m2]), abs(rr - v[m2])))
      l = m1;
    else
      r = m2;
  }
  int ans = INT32_MAX;
  for (int i = l; i <= r; ++i) {
    ans = min(ans, max(abs(ll - v[i]), abs(rr - v[i])));
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
  srand((uint32_t)time(nullptr));
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> c;
    if (c == '0') {
      v.push_back(i);
    }
  }
  m = INT32_MAX;
  for (int l = 0, r = k; r < v.size(); ++l, ++r) {
    m = min(m, search(l, r, v[l], v[r]));
  }
  cout << m << endl;
  return 0;
}
