#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
char s[100005];
int a[100005];
int sum[100005];
int ans = 0x3f3f3f3f;
int n, k;
int check(int len, int i) {
  int res = 0;
  res += sum[i - 1] - sum[max(0, i - len) - 1];
  res += sum[min(i + len, n - 1)] - sum[i];
  return res >= k;
}
int slove(int i) {
  int l = 0, r = n, mid;
  int ans;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid, i)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%s", s);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      sum[i] = 1 + sum[i - 1];
    } else {
      sum[i] = sum[i - 1];
    }
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      ans = min(slove(i), ans);
    }
  }
  printf("%d\n", ans);
  return 0;
}
