#include <bits/stdc++.h>
char s[200002];
int N, K;
bool check(int mid) {
  int last = 1, used = 1;
  while (1) {
    int p = std::min(N, last + mid);
    while (s[p] == '1') p--;
    if (last == p) return false;
    last = p;
    used++;
    if (used > K) return false;
    if (p == N) return true;
  }
}
int main() {
  scanf("%d%d", &N, &K);
  scanf("%s", s + 1);
  int l = 1, r = N - 1;
  while (l < r) {
    int m = l + r >> 1;
    if (check(m))
      r = m;
    else
      l = m + 1;
  }
  printf("%d\n", l - 1);
  return 0;
}
