#include <bits/stdc++.h>
using namespace std;
string s;
int from_start[10000000];
int from_end[10000000];
int two_pointer(int low, int high, int n) {
  int minimum = 9999999, tmp, tmp2, tmp1;
  int left = low, right = high;
  while (high < n) {
    tmp = (low + high) / 2;
    tmp1 = max(high - from_start[tmp], from_start[tmp] - low);
    tmp2 = max(high - from_end[tmp], from_end[tmp] - low);
    tmp = min(tmp1, tmp2);
    minimum = min(tmp, minimum);
    while (high + 1 < n && s[high + 1] == '1') high++;
    high++;
    if (high == n) break;
    low++;
    while (s[low] == '1') low++;
  }
  if (minimum == 9999999) {
    tmp = (left + right) / 2;
    tmp1 = max(right - from_start[tmp], from_start[tmp] - left);
    tmp2 = max(right - from_end[tmp], from_end[tmp] - left);
    tmp = min(tmp1, tmp2);
    minimum = min(tmp, minimum);
  }
  return minimum;
}
int main() {
  ios::sync_with_stdio(false);
  ifstream fin("");
  ofstream fout("");
  int n, k, tmp = 0;
  cin >> n >> k;
  cin >> s;
  int low = 0, high = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      cnt++;
      if (cnt == k + 1) high = i;
      from_start[i] = i;
      tmp = i;
    } else
      from_start[i] = tmp;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '0') {
      from_end[i] = i;
      tmp = i;
      low = i;
    } else
      from_end[i] = tmp;
  }
  int ans = two_pointer(low, high, n);
  cout << ans << endl;
  return 0;
}
