#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> way(s.size());
  way[0] = 0;
  for (int i = 1; i < (int)s.size(); i++) {
    if (s[i] == '0')
      way[i] = i;
    else
      way[i] = way[i - 1];
  }
  int l = 0, r = n - 1;
  while (r - l > 1) {
    int m = (l + r) / 2;
    int cnt = k - 1;
    int now = 0;
    int last = 0;
    while (now < n && cnt > 0) {
      now += m;
      now = min(now, n - 1);
      now = way[now];
      cnt--;
      last = max(last, now);
    }
    if (last == n - 1) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << l << '\n';
  return 0;
}
