#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
vector<int> prevv;
int minn(int a, int b) {
  if (a < b) {
    return a;
  }
  return b;
}
bool check(int x) {
  int c = 1;
  int cur = 0;
  while (cur != n - 1) {
    int now = prevv[minn(n - 1, cur + x + 1)];
    if (now == cur) {
      return false;
    }
    cur = now;
    c++;
  }
  return (c <= k);
}
int main() {
  cin >> n >> k;
  cin >> s;
  prevv.resize(n);
  int last = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      last = i;
    }
    prevv[i] = last;
  }
  int l = -1, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << endl;
}
