#include <bits/stdc++.h>
using namespace std;
int n, k, aa, bb;
int pre[1000005];
string st;
long long res;
bool check(int start, int en) {
  int ans = pre[en] - pre[start - 1];
  if (ans >= k + 1) return 1;
  return 0;
}
int binarysearch() {
  int ans = n, finalans = n, l = 0, r = n, ma = -1;
  for (int i = 0; i < n; i++) {
    if (st[i] == '1') continue;
    l = 0;
    r = n;
    ans = n - 1;
    while (l < r) {
      int mid = (l + r) / 2;
      if (i - mid > 0)
        aa = i - mid;
      else
        aa = 0;
      if (i + mid < n)
        bb = i + mid;
      else
        bb = n - 1;
      if (pre[bb] - pre[aa - 1] >= k + 1) {
        r = mid;
        ans = mid;
      } else
        l = mid + 1;
    }
    finalans = min(ans, finalans);
  }
  return finalans;
}
int main() {
  cin >> n >> k;
  cin >> st;
  for (int i = 0; i < n; i++) {
    if (st[i] == '0') {
      pre[i] = pre[i - 1] + 1;
    } else {
      pre[i] = pre[i - 1];
    }
  }
  res = binarysearch();
  cout << res << endl;
  return 0;
}
