#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int INF = 1e5 + 7;
string s;
int cnt[N];
int n, k;
bool isaac(int x) {
  for (int i = 0; i < n; i++)
    if (s[i] == '0' &&
        cnt[i] - cnt[max(0, i - x)] + cnt[min(i + x + 1, n)] - cnt[i + 1] >= k)
      return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < n; i++) cnt[i + 1] = cnt[i] + (s[i] == '0');
  int l = 0, r = INF;
  while (r - l > 1) {
    int mid = (r + l) / 2;
    if (isaac(mid))
      r = mid;
    else
      l = mid;
  }
  cout << r << "\n";
  return 0;
}
