#include <bits/stdc++.h>
using namespace std;
vector<int> nul;
int n, k;
string s;
int ser(int sti, int stj, int i, int j) {
  if (j - i > 1) {
    int a = (i + i + j) / 3;
    if (a == i) ++a;
    int b = (i + j + j) / 3;
    if (b == j) --b;
    if (max(nul[a] - nul[sti], nul[stj] - nul[a]) <
        max(nul[stj] - nul[b], nul[b] - nul[sti])) {
      return ser(sti, stj, i, b);
    } else {
      return ser(sti, stj, a, j);
    }
  } else {
    return j;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> k;
  cin >> s;
  int l = s.length();
  for (int(i) = (0); (i) < int(l); ++(i)) {
    if (s[i] == '0') nul.push_back(i);
  }
  long long ans = 0x3F3F3F3F;
  for (int(i) = (0); (i) < int(nul.size()); ++(i)) {
    if (i + k >= nul.size()) break;
    int res = ser(i, i + k, i, i + k);
    ans = min(ans, 1ll * max(nul[res] - nul[i], nul[i + k] - nul[res]));
    ans = min(ans, 1ll * max(nul[res - 1] - nul[i], nul[i + k] - nul[res - 1]));
  }
  cout << ans << "\n";
  cin.sync();
  cin.get();
  return 0;
}
