#include <bits/stdc++.h>
int n, f[200000], k;
int ttry(int dist) {
  int kk = k - 1;
  int i = 0;
  while (kk > 0) {
    i += dist;
    if (i > n) i = n - 1;
    i = i - f[i];
    kk--;
  }
  if (i < n - 1)
    return 0;
  else
    return 1;
}
int main() {
  char c;
  scanf("%d %d", &n, &k);
  scanf("%c", &c);
  for (int i = 0; i < n; i++) {
    scanf("%c", &c);
    if (c == '1')
      f[i] = f[i - 1] + 1;
    else
      f[i] = 0;
  }
  int l = 1, r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (ttry(mid) == 1)
      r = mid;
    else
      l = mid + 1;
  }
  if (ttry(l) == 1)
    printf("%d", l - 1);
  else
    printf("%d", r - 1);
  return 0;
}
