#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int TMXN = 1e6 * 4 + 1;
const int INF = 1e9 + 7;
const long long INFL = 1e18;
int n, k;
char a[N];
int mink = INF;
int pref[N];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (!(a[i] - 48)) {
      pref[i] = pref[i - 1] + 1;
    } else {
      pref[i] = pref[i - 1];
    }
  }
  for (int i = n + 1; i <= N; i++) {
    pref[i] = pref[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    int l = 0;
    int r = max(n - i, i - 1) + 1;
    if (a[i] == '0') {
      while (r - l > 1) {
        int mid = (r + l) / 2;
        if (pref[i + mid] - pref[max(i - mid - 1, 0)] >= k + 1) {
          r = mid;
        } else {
          l = mid;
        }
      }
      if (pref[i + r] - pref[max(i - r - 1, 0)] >= k + 1) {
        mink = min(mink, r);
      }
      if (pref[i + l] - pref[max(i - l - 1, 0)] >= k + 1) {
        mink = min(mink, l);
      }
    }
  }
  cout << mink;
  return 0;
}
