#include <bits/stdc++.h>
using namespace std;
int const MN = 2e5 + 200;
int ans = 1e9, n, m, ps[MN];
string s;
bool check(int i, int x) {
  int r = ps[i + x + 1], l = 0;
  if (i + x + 1 > n) r = ps[n];
  if (i - x > 0) l = ps[i - x];
  if (r - l >= m + 1)
    return 1;
  else
    return 0;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> s;
  for (int i = 0; i < n; i++) ps[i + 1] = ps[i] + (s[i] == '0' ? 1 : 0);
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') continue;
    int l = -1, r = n;
    while (r - l > 1) {
      int mid = l + r >> 1;
      if (!check(i, mid))
        l = mid;
      else
        r = mid;
    }
    ans = min(ans, r);
  }
  cout << ans;
}
