#include <bits/stdc++.h>
using namespace std;
const int N = 111111;
int n, k;
string str;
int sum[N];
bool check(int mid) {
  for (int i = 1; i <= n; i++) {
    if (str[i - 1] == '1') continue;
    int L = max(i - mid, 1);
    int R = min(i + mid, n);
    if (sum[R] - sum[L - 1] >= k + 1) return true;
  }
  return false;
}
int main() {
  cin >> n >> k;
  cin >> str;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + (str[i - 1] == '0');
  }
  int l = 1, r = n - 1;
  int ans = n - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
