#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
int nearZeroL[100009], nearZeroR[100009];
int main() {
  cin >> n >> k >> s;
  int num = 0;
  int j = 0;
  if (s[0] == '1') {
    nearZeroL[0] = 1000000009;
  }
  for (int i = 1; i < n; i++) {
    if (s[i] == '0')
      nearZeroL[i] = 0;
    else
      nearZeroL[i] = nearZeroL[i - 1] + 1;
  }
  if (s[n - 1] == '1') {
    nearZeroR[0] = 1000000009;
  }
  for (int i = n - 2; i >= 0; i--) {
    if (s[i] == '0')
      nearZeroR[i] = 0;
    else
      nearZeroR[i] = nearZeroR[i + 1] + 1;
  }
  int ans = 1000000009;
  if (s[0] == '0') num++;
  k++;
  for (int i = 0; i < n; i++) {
    while (num < k && j < n) {
      j++;
      if (s[j] == '0') num++;
    }
    if (num < k) break;
    int c = (j + i) / 2;
    int c1 = c - nearZeroL[c], c2 = c + nearZeroR[c];
    ans = min(ans, min(max(j - c1, c1 - i), max(j - c2, c2 - i)));
    if (s[i] == '0') num--;
  }
  cout << ans << endl;
}
