#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = 0x3f3f3f3f, N = 2e5 + 10;
const double pi = acos(-1);
using namespace std;
char s[N];
int num[N];
int main() {
  int n, k;
  while (cin >> n >> k) {
    scanf("%s", s + 1);
    memset(num, 0, sizeof(num));
    for (int i = 1; s[i]; i++) {
      if (s[i] == '0')
        num[i] = num[i - 1] + 1;
      else
        num[i] = num[i - 1];
    }
    int ans = inf;
    int last = 0;
    if (k == 1) {
      for (int i = 1; i <= n; i++) {
        if (!last && s[i] == '0')
          last = i;
        else if (last && s[i] == '0') {
          ans = i - last;
          break;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      if (s[i] == '1') continue;
      int l = 1, r = n;
      while (l <= r) {
        int mid = (l + r) >> 1;
        int st = max(1, i - mid);
        int en = min(n, i + mid);
        if (num[en] - num[st - 1] >= k + 1)
          r = mid - 1;
        else
          l = mid + 1;
      }
      ans = min(ans, l);
    }
    cout << ans << endl;
  }
  return 0;
}
