#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int comp(int r, int st, int en) {
  int p1 = 99999999, p2 = 99999999, p3 = 9999999;
  if (r - 1 >= 0) {
    p1 = max(v[en] - v[r - 1], v[r - 1] - v[st]);
  }
  if (r + 1 < v.size()) {
    p2 = max(v[en] - v[r + 1], v[r + 1] - v[st]);
  }
  p3 = max(v[en] - v[r], v[r] - v[st]);
  if (p1 < p2 && p1 < p3)
    return 2;
  else if (p2 < p3 && p2 < p1)
    return 3;
  else
    return 1;
}
int bs(int str, int end) {
  int st = str, en = end;
  while (st <= en) {
    int mid = (st + en) / 2;
    int c = comp(mid, str, end);
    if (c == 1)
      return max(v[end] - v[mid], v[mid] - v[str]);
    else if (c == 2)
      en = mid - 1;
    else
      st = mid + 1;
  }
  return (max(v[end] - v[st], v[st] - v[str]));
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      v.push_back(i);
    }
  }
  int mind = 99999999;
  for (int i = 0; i < v.size() - k; i++) {
    mind = min(mind, bs(i, i + k));
  }
  cout << mind;
}
