#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return (a > b ? a : b); }
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  long long n, d, a;
  long long k;
  map<long long, long long> mapp;
  cin >> n >> k;
  char ch;
  long long minnl = n;
  long long j = 0;
  for (long long i = 0; i < n; i++) {
    cin >> ch;
    if (ch == '0') {
      mapp[j] = i;
      if (j > 0) minnl = min(minnl, mapp[j] - mapp[j - 1]);
      j++;
    }
  }
  if (k == 1) {
    cout << minnl;
    return 0;
  }
  long long min1 = n + 1;
  long long minn = n + k;
  long long mini = k;
  map<long long, set<long long>> prostotak;
  for (long long i = k; i < j; i++) {
    long long mmik = mapp[i] - mapp[i - k];
    minn = mmik;
    mini = i;
    prostotak[minn].insert(i);
    long long l = 0;
    long long med = (mini + mini - k) / 2;
    long long prev1 = n + k;
    long long prev2 = n + k;
    while (true) {
      long long abs1 = max(abs(mapp[mini - k] - mapp[med + l]),
                           abs(mapp[mini] - mapp[med + l]));
      long long abs2 = max(abs(mapp[mini - k] - mapp[med - l]),
                           abs(mapp[mini] - mapp[med - l]));
      if ((abs1 > prev1) && (abs2 > prev2)) break;
      prev1 = min(prev1, abs1);
      prev2 = min(prev2, abs2);
      l++;
    }
    min1 = min(min1, min(prev1, prev2));
  }
  cout << min1;
  return 0;
}
