#include <bits/stdc++.h>
using namespace std;
int s1[100010];
int main() {
  string s;
  int n, k, ans = 100100, j = 1;
  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '0') {
      s1[j] = i + 1;
      j++;
    }
  }
  j--;
  for (int i = 1; i <= j - k; i++) {
    int l1, l2, ans1 = 100100;
    l1 = i;
    l2 = i + k;
    int l = (l1 + l2) / 2;
    ans1 = min(ans1, max(s1[l] - s1[l1], s1[l2] - s1[l]));
    if (s1[l] - s1[l1] > s1[l2] - s1[l]) {
      while (s1[l] - s1[l1] > s1[l2] - s1[l]) {
        l--;
        ans1 = min(ans1, max(s1[l] - s1[l1], s1[l2] - s1[l]));
      }
    } else if (s1[l] - s1[l1] < s1[l2] - s1[l]) {
      while (s1[l] - s1[l1] < s1[l2] - s1[l]) {
        l++;
        ans1 = min(ans1, max(s1[l] - s1[l1], s1[l2] - s1[l]));
      }
    }
    ans = min(ans, ans1);
  }
  cout << ans << endl;
}
