#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  string rooms;
  int n, k;
  while (cin >> n) {
    cin >> k;
    cin >> rooms;
    vector<int> counts(n, 0);
    counts[0] = rooms[0] == '0';
    for (int i = 1; i < n; i++) {
      counts[i] = counts[i - 1] + (rooms[i] == '0');
    }
    int left = 0;
    while (left < n && counts[left] == 0) {
      left++;
    }
    int right = 0;
    while (right < n && counts[right] < k + 1) {
      right++;
    }
    int bestAns = n;
    while (right < n) {
      int m = left + (right - left + 1) / 2;
      if (rooms[m] == '0') {
        bestAns = min(bestAns, max(m - left, right - m));
      } else {
        int a = left;
        int b = m;
        while (a < b - 1) {
          int test = (a + b) / 2;
          if (counts[m] == counts[test] && rooms[test] == '1') {
            b = test;
          } else {
            a = test;
          }
        }
        int ans1 = max(a - left, right - a);
        a = m;
        b = right;
        while (a < b - 1) {
          int test = (a + b) / 2;
          if (counts[m] == counts[test] && rooms[test] == '1') {
            a = test;
          } else {
            b = test;
          }
        }
        int ans2 = max(b - left, right - b);
        bestAns = min(bestAns, min(ans1, ans2));
      }
      right++;
      if (right >= n || counts[right] == counts[right - 1]) {
        continue;
      }
      left++;
      while (counts[left] == counts[left - 1]) {
        left++;
      }
    }
    cout << bestAns << endl;
  }
  return 0;
}
