#include <bits/stdc++.h>
const int MAX_N = (int)1e5 + 123;
const double eps = 1e-6;
const int inf = (int)1e9 + 123;
using namespace std;
int n, k;
int mini = inf;
string second;
int sum[MAX_N];
int main() {
  cin >> n >> k >> second;
  for (int i = 0; i < int((second).size()); i++)
    sum[i] = (i > 0 ? sum[i - 1] : 0) + (second[i] == '0');
  vector<int> q;
  for (int i = 0; i < int((second).size()); i++)
    if (second[i] == '0') q.push_back(i);
  for (int i = 0; i < int((second).size()); i++) {
    if (sum[int((second).size()) - 1] - (i > 0 ? sum[i - 1] : 0) < k + 1) break;
    int l = i, r = int((second).size()) - 1, mid = -1, ans = -1;
    while (l <= r) {
      mid = (l + r) / 2;
      if (sum[mid] - (i > 0 ? sum[i - 1] : 0) >= k + 1) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    assert(ans != -1);
    int now = ans - i;
    if ((ans - i + 1) % 2 == 1) {
      int mid = (ans + i) / 2;
      auto it = lower_bound(q.begin(), q.end(), mid);
      if (it != q.end()) now = min(now, max(*it - i, ans - *it));
      if (it != q.begin()) {
        it--;
        now = min(now, max(*it - i, ans - *it));
      }
    } else {
      int mid = (ans + i) / 2 + 1;
      auto it = lower_bound(q.begin(), q.end(), mid);
      if (it != q.end()) now = min(now, max(*it - i, ans - *it));
      mid--;
      it = lower_bound(q.begin(), q.end(), mid);
      if (it != q.end()) now = min(now, max(*it - i, ans - *it));
      if (it != q.begin()) {
        it--;
        now = min(now, max(*it - i, ans - *it));
      }
    }
    mini = min(mini, now);
  }
  cout << mini;
  return 0;
}
