#include <bits/stdc++.h>
char s[200007];
int n, kk;
int check(int x) {
  int k = kk;
  --k;
  int prev = 0;
  for (int i = 1; i < n - 1; ++i) {
    if (i - prev - 1 == x) {
      int j = i;
      while (s[j] == '1') --j;
      if (j <= prev) return 0;
      prev = j;
      --k;
    }
  }
  if (n - 1 - prev - 1 > x) return 0;
  --k;
  if (k < 0) return 0;
  return 1;
}
int main() {
  scanf("%d %d", &n, &kk);
  scanf("%s", s);
  int l = 0;
  int r = n;
  while (r - l > 1) {
    int m = (r + l) / 2;
    if (check(m))
      r = m;
    else
      l = m + 1;
  }
  for (int i = l; i <= r; ++i) {
    if (check(i)) {
      printf("%d", i);
      break;
    }
  }
}
