#include <bits/stdc++.h>
using namespace std;
const int inf = (int)2 * 1e9;
const int MOD = (int)1e9 + 7;
const int p = 239;
const int MAX_N = 10;
const long double pi = 3.1415926535897932384626;
const long double eps = 1e-6;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n + 1], u[n + 1];
  for (int i = 0; i <= n; i++) a[i] = 0;
  for (int i = 1; i <= n; i++) {
    char p;
    cin >> p;
    a[i] = '1' - p;
    u[i] = a[i];
  }
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  int l = 0, r = n, mid;
  while (r - l > 1) {
    mid = (l + r) / 2;
    bool b = false;
    for (int i = 1; i <= n; i++)
      if (u[i]) {
        int cnt = a[i - 1] - a[max(0, i - mid - 1)] + a[min(n, i + mid)] - a[i];
        if (cnt >= k) {
          b = true;
          break;
        }
      }
    if (b)
      r = mid;
    else
      l = mid;
  }
  cout << r;
  return 0;
}
