#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, l, length, i, ele, low, high, mid, pos, ele2, pos1, pos2, fin;
  cin >> n >> k;
  string a;
  cin >> a;
  l = k + 1;
  deque<int> dq;
  fin = INT_MAX;
  for (i = 0; i < n; i++) {
    if (a[i] == '0') {
      dq.push_back(i);
    }
    while (dq.size() > k + 1) {
      dq.pop_front();
    }
    if (dq.size() == k + 1) {
      length = dq.back() - dq.front() + 1;
      length = length / 2;
      ele = dq.front() + length;
      low = 0;
      high = dq.size() - 1;
      pos = -1;
      while (low <= high) {
        mid = low + high;
        mid = mid / 2;
        if (dq[mid] <= ele && dq[mid + 1] > ele) {
          pos = mid;
          break;
        } else if (mid + 1 < dq.size() && dq[mid] <= ele &&
                   dq[mid + 1] <= ele) {
          low = mid + 1;
        } else if (mid + 1 == dq.size() && dq[mid] <= ele) {
          pos = mid;
          break;
        } else if (dq[mid] > ele) {
          high = mid - 1;
        }
      }
      if (pos != -1) {
        ele = dq[pos];
        pos1 = max(ele - dq.front(), dq.back() - ele);
        ele = pos1;
        if (pos != dq.size() - 1) {
          ele2 = dq[pos + 1];
          pos2 = max(ele2 - dq.front(), dq.back() - ele2);
          ele = min(pos1, pos2);
        }
        fin = min(fin, ele);
      }
    }
  }
  cout << fin << "\n";
  return 0;
}
