#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int MAX = 1e5 + 13;
int n, k;
char c[MAX];
int dp[MAX];
bool condition(int m) {
  for (int j = 1; j <= n; j++) {
    if (c[j] == '1') continue;
    int s = 0;
    s += dp[j - 1] - dp[max(1, j - m) - 1];
    s += dp[min(n, j + m)] - dp[j];
    if (s >= k) return true;
  }
  return false;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    dp[i] = dp[i - 1] + (c[i] == '0');
  }
  int l = 0, r = n;
  while (r - l > 1) {
    int m = (r + l) / 2;
    if (condition(m))
      r = m;
    else
      l = m;
  }
  cout << r;
  return 0;
}
