#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int sum[n];
  for (int i = 0; i < n; i++) sum[i] = (s[i] - '0') ^ 1;
  for (int i = 1; i < n; i++) sum[i] += sum[i - 1];
  int ans = n;
  int cnt = 0;
  k++;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') continue;
    if (cnt + k > sum[n - 1]) break;
    int r = lower_bound(sum, sum + n, cnt + k) - sum;
    int m1 = lower_bound(sum, sum + n, sum[(i + r) / 2]) - sum;
    int m2 = upper_bound(sum, sum + n, sum[(i + r) / 2]) - sum;
    int temp = min(r - m1, m2 - i);
    ans = min(ans, temp);
    cnt++;
  }
  cout << ans << "\n";
  return 0;
}
