#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 7;
const int Inf = 1e9 + 7;
int N, K;
char A[Maxn];
int sum[Maxn];
bool check(int num) {
  for (int i = 1; i <= N; i++) {
    if (A[i] != '0') continue;
    if (sum[min(N, i + num)] - sum[max(0, i - num - 1)] >= K + 1) {
      return true;
    }
  }
  return false;
}
int main() {
  while (~scanf(" %d %d", &N, &K)) {
    scanf(" %s", A + 1);
    memset(sum, 0, sizeof(sum));
    ;
    for (int i = 1; i <= N; i++) {
      if (A[i] == '0') {
        sum[i] = sum[i - 1] + 1;
      } else {
        sum[i] = sum[i - 1];
      }
    }
    int L = 1, R = N;
    int ans = N;
    while (L <= R) {
      int mid = (L + R) >> 1;
      if (check(mid)) {
        R = mid - 1;
        ans = min(ans, mid);
      } else {
        L = mid + 1;
      }
    }
    printf("%d\n", ans);
  }
}
