#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  map<long long, long long> m;
  long long c = 0;
  for (long long i = 0; i < n; i++) {
    if (str[i] == '0') {
      ++c;
      m[c] = i;
    }
  }
  long long ans = n;
  for (long long i = 1; i <= c - k; i++) {
    long long l = i, r = i + k, mn = 1e18;
    while (l <= r) {
      long long mid = (l + r) / 2;
      if (m[mid] - m[i] > m[i + k] - m[mid]) {
        mn = min(mn, m[mid] - m[i]);
        r = mid - 1;
      } else if (m[mid] - m[i] < m[i + k] - m[mid]) {
        mn = min(mn, m[i + k] - m[mid]);
        l = mid + 1;
      } else if (m[mid] - m[i] == m[i + k] - m[mid]) {
        mn = min(mn, m[i + k] - m[mid]);
        break;
      }
    }
    ans = min(ans, mn);
  }
  cout << ans;
}
