#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e15;
const long long int MAX = 3e5 + 5;
const long long int MAXK = 20;
const long long int mod = 1e9 + 7;
long long int gcd(long long int a, long long int b) {
  while (b > 0) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b % 2 == 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res % mod;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '0') v.push_back(i);
  }
  long long int i = 0, j = k;
  long long int m = 0;
  long long int ans = INT_MAX;
  while (j < v.size()) {
    while (abs(v[j] - v[m]) >= abs(v[i] - v[m])) {
      ans = min(ans, max(abs(v[j] - v[m]), abs(v[i] - v[m])));
      m++;
    }
    ans = min(ans, max(abs(v[j] - v[m]), abs(v[i] - v[m])));
    j++;
    i++;
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve();
  }
}
