#include <bits/stdc++.h>
char s[200005];
int sum[200005];
int n, k;
int check(int d) {
  int now = 0;
  int cnt = k - 1;
  int ind = 1;
  while (1) {
    if (now == n - 1) {
      break;
    }
    if (cnt == 0) {
      return 0;
    }
    int willeat = -1;
    if (ind < now + 1) {
      ind = now + 1;
    }
    while (1) {
      if (ind - now - 1 > d) {
        break;
      }
      if (s[ind] == '0') {
        willeat = ind;
      }
      if (ind == n - 1) {
        break;
      }
      ++ind;
    }
    if (willeat == -1) {
      return 0;
    }
    now = willeat;
    --cnt;
  }
  return 1;
}
int main() {
  scanf("%d %d %s", &n, &k, s);
  sum[0] = 0;
  for (int i = 1; i < n; ++i) {
    sum[i] = sum[i - 1];
    if (s[i] == '1') {
      ++sum[i];
    }
  }
  int l = -1, r = n + 1;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  printf("%d", r);
  return 0;
}
