#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6 + 10;
int n, k;
string s;
int a[MAX];
bool check(string s, int n, int k, int mid) {
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      int res = a[min(n, i + mid)] - a[max(0, i - mid - 1)];
      if (res >= k + 1) return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k;
  cin >> s;
  s = ' ' + s;
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1] + (s[i] == '0');
  }
  int l = 0;
  int r = n + 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(s, n, k, mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  cout << r + 1;
}
