#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  int n, k;
  string s;
  while (cin >> n) {
    cin >> k;
    cin >> s;
    vector<int> count(n, 0);
    for (int i = 1; i < n; i++) {
      count[i] = count[i - 1] + (s[i] == '0' ? 1 : 0);
    }
    int left = 0;
    while (s[left] != '0') {
      left++;
    }
    int right = 0;
    while (right < n && count[right] - count[left] < k) {
      right++;
    }
    int ans = n;
    int m = 0;
    int bestM = 0;
    int nextM = 0;
    for (; m <= right; m++) {
      if (s[m] == '1') {
        continue;
      }
      int testAns = max(m - left, right - m);
      ans = min(ans, testAns);
      if (testAns < ans) {
        testAns = ans;
        bestM = m;
        nextM = m;
      } else if (nextM == bestM) {
        nextM = m;
      }
    }
    while (right < n) {
      left++;
      while (s[left] != '0') {
        left++;
      }
      while (right < n && count[right] - count[left] < k) {
        right++;
      }
      if (right >= n) {
        break;
      }
      while (nextM < n) {
        int testAns = max(bestM - left, right - bestM);
        ans = min(ans, testAns);
        int testAns2 = max(nextM - left, right - nextM);
        ans = min(ans, testAns2);
        if (testAns2 <= testAns) {
          bestM = nextM;
          nextM++;
          while (nextM < n && s[nextM] != '0') {
            nextM++;
          }
        } else {
          break;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
