#include <bits/stdc++.h>
using namespace std;
deque<int> dq;
string s;
int k;
int left(int item) {
  while (s[item] == '1') item--;
  return item;
}
int right(int item) {
  while (s[item] == '1') item++;
  return item;
}
int check() {
  int j = dq[0], i = dq[k - 1];
  int p1 = left((i + j) / 2);
  int p2 = right((i + j) / 2);
  int num1 = max(p1 - j, i - p1);
  int num2 = max(p2 - j, i - p2);
  int cur;
  if (num1 <= num2)
    cur = p1;
  else
    cur = p2;
  return max(cur - j, i - cur);
}
int main() {
  int pos = 0, len;
  cin >> len >> k >> s;
  k++;
  int shit = 0;
  while (shit < k) {
    if (s[pos] == '0') {
      shit++, dq.push_back(pos);
    }
    pos++;
  }
  int ans = check();
  while (pos < len) {
    if (s[pos] == '0') {
      dq.pop_front();
      dq.push_back(pos);
      ans = min(ans, check());
    }
    pos++;
  }
  cout << ans << endl;
  return 0;
}
