#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, k;
string s;
int cnt[maxn];
bool ok(int dist) {
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '1') continue;
    int pid = i - dist;
    int sid = i + dist;
    int tot = cnt[i - 1] - cnt[max(0, pid - 1)] + cnt[min(n, sid)] - cnt[i];
    if (tot >= k) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i <= n; i++) cnt[i] = 0;
  for (int i = 0; i <= n - 1; i++)
    if (s[i] == '0') cnt[i + 1] = 1;
  for (int i = 1; i <= n; i++) cnt[i] += cnt[i - 1];
  int l = 1, r = n - 1;
  while (l < r) {
    int m = (l + r) / 2;
    if (ok(m))
      r = m;
    else
      l = m + 1;
  }
  cout << l << "\n";
  return 0;
}
