#include <bits/stdc++.h>
using namespace std;
const int inf = -0x3ffffff;
const long long maxn = 1000001;
void read(int &x) {
  char ch;
  bool flag = 0;
  for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1);
       ch = getchar())
    ;
  for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar())
    ;
  x *= 1 - 2 * flag;
}
char s[maxn];
int s1[maxn], s2[maxn];
int n, m;
bool check(int mid) {
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    if (s[i] == '1') continue;
    if (i - mid >= 1) {
      sum = sum + s1[i - 1] - s1[i - mid - 1];
    } else {
      sum = s1[i - 1];
    }
    if (i + mid <= n) {
      sum = sum + s2[i + 1] - s2[i + mid + 1];
    } else {
      sum += s2[i + 1];
    }
    if (mid == 1) {
    }
    if (sum >= m) return true;
  }
  return false;
}
int main() {
  read(n), read(m);
  cin >> (s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      s1[i] = s1[i - 1] + 1;
    } else {
      s1[i] = s1[i - 1];
    }
  }
  for (int i = n; i >= 1; i--) {
    if (s[i] == '0') {
      s2[i] = s2[i + 1] + 1;
    } else {
      s2[i] = s2[i + 1];
    }
  }
  int l = 0, r = n;
  for (int i = 0; i < 50; i++) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r;
  return 0;
}
