#include <bits/stdc++.h>
using namespace std;
string a, b, c, d;
int pref[123456];
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s = '.' + s;
  for (int i = 1; i < s.length(); i++) {
    pref[i] = pref[i - 1];
    if (s[i] == '0') pref[i]++;
  }
  int ans = INT_MAX;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '0') {
      int lo = k / 2;
      int hi = s.length() - 1;
      while (hi - lo > 2) {
        int mid = (lo + hi) / 2;
        int lft = max(0, i - mid);
        int cccc = s.length() - 1;
        int rt = min(cccc, i + mid);
        if (pref[rt] - pref[lft - 1] < k + 1)
          lo = mid;
        else
          hi = mid;
      }
      while (lo <= hi) {
        int lft = max(0, i - lo);
        int cccc = s.length() - 1;
        int rt = min(cccc, i + lo);
        if (pref[rt] - pref[lft - 1] < k + 1) lo++;
        if (pref[rt] - pref[lft - 1] >= k + 1) break;
      }
      ans = min(ans, lo);
    }
  }
  cout << ans;
}
