#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const double pi = acos(-1.0);
int n, k;
string s;
int a[100005];
int solve() {
  int ans = inf;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '1') continue;
    int l = i, r = n, p = 0;
    while (r >= l) {
      int mid = (l + r) / 2;
      if (a[mid] - a[i] >= k) {
        r = mid - 1;
        p = mid;
      } else
        l = mid + 1;
    }
    if (!p)
      break;
    else {
      int u, v, q;
      if ((p - i) % 2)
        u = (p + i) / 2, v = u + 1;
      else
        u = v = (p + i) / 2;
      for (;; u--, v++) {
        if (s[u - 1] == '0') {
          q = u;
          break;
        } else if (s[v - 1] == '0') {
          q = v;
          break;
        }
      }
      ans = min(ans, max(q - i, p - q));
    }
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &k);
  cin >> s;
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] + (s[i - 1] == '0' ? 1 : 0);
  printf("%d\n", solve());
  return 0;
}
