#include <bits/stdc++.h>
using namespace std;
int MinDist(int n, int k, const string& s) {
  int first_cow_pos = 0;
  while (first_cow_pos < n && s[first_cow_pos] == '1') {
    ++first_cow_pos;
  }
  int last_cow_pos = first_cow_pos;
  int rooms = 1;
  while (rooms < k + 1) {
    ++last_cow_pos;
    if (s[last_cow_pos] == '0') {
      ++rooms;
    }
  }
  int farmer_pos = first_cow_pos;
  int delta = last_cow_pos - first_cow_pos;
  for (int i = first_cow_pos + 1; i <= last_cow_pos; ++i) {
    if (s[i] == '0' && i - first_cow_pos < delta && last_cow_pos - i < delta) {
      delta = max(i - first_cow_pos, last_cow_pos - i);
      farmer_pos = i;
    }
  }
  --rooms;
  for (++first_cow_pos; first_cow_pos < n; ++first_cow_pos) {
    if (s[first_cow_pos] == '1') {
      continue;
    }
    while (rooms < k + 1 && last_cow_pos < n) {
      ++last_cow_pos;
      if (last_cow_pos == n) {
        break;
      }
      if (s[last_cow_pos] == '0') {
        ++rooms;
      }
    }
    if (last_cow_pos == n) {
      break;
    }
    int npos = max(farmer_pos, first_cow_pos);
    int cur_delta = max(farmer_pos - first_cow_pos, last_cow_pos - farmer_pos);
    while (npos < last_cow_pos) {
      ++npos;
      if (s[npos] == '1') {
        continue;
      }
      if (npos - first_cow_pos < cur_delta && last_cow_pos - npos < cur_delta) {
        cur_delta = max(npos - first_cow_pos, last_cow_pos - npos);
        farmer_pos = npos;
      } else if (npos - first_cow_pos >= cur_delta) {
        break;
      }
    }
    delta = min(delta, cur_delta);
    --rooms;
  }
  return delta;
}
int MinDistSlow(int n, int k, const string& s) {
  int result = n;
  for (int fcp = 0; fcp < n; ++fcp) {
    if (s[fcp] == '1') {
      continue;
    }
    int lcp = fcp;
    int rooms = 1;
    while (rooms < k + 1 && lcp < n) {
      ++lcp;
      if (lcp == n) {
        break;
      }
      if (s[lcp] == '0') {
        ++rooms;
      }
    }
    if (lcp == n) {
      break;
    }
    for (int fp = fcp; fp <= lcp; ++fp) {
      if (s[fp] == '1') {
        continue;
      }
      int delta = max(fp - fcp, lcp - fp);
      if (delta < result) {
        result = delta;
      }
    }
  }
  return result;
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  char buffer[1000000];
  scanf("%s", buffer);
  s = buffer;
  int delta = MinDist(n, k, s);
  cout << delta << endl;
  return 0;
}
