#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int close_left[n], close_right[n];
  close_left[0] = close_right[n - 1] = -1;
  if (s[0] == '0') close_left[0] = 0;
  if (s[n - 1] == '0') close_right[n - 1] = n - 1;
  for (int i = 1; i < n; i++) {
    if (s[i] != '1')
      close_left[i] = i;
    else
      close_left[i] = close_left[i - 1];
  }
  for (int i = n - 2; i >= 0; i--) {
    if (s[i] == '0')
      close_right[i] = i;
    else
      close_right[i] = close_right[i + 1];
  }
  int i = 0, count = 0, j = 0;
  while (count <= k) {
    if (s[i] == '0') count++;
    i++;
  }
  while (s[j] == '1') j++;
  i--;
  int res = INT_MAX;
  while (i < n) {
    int mid = (j + i) / 2;
    if (s[mid] == '0')
      res = min(res, max(abs(mid - j), abs(i - mid)));
    else
      res = min(res, min(i - close_left[mid], close_right[mid] - j));
    i++;
    j++;
    while (i < n && s[i] == '1') i++;
    while (j < i && s[j] == '1') j++;
  }
  cout << res;
}
