#include <bits/stdc++.h>
using namespace std;
int n, k, s[100005], ans = 2147483647;
char p[100005];
char ch;
int main(void) {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> ch;
    if (i)
      s[i] = s[i - 1] + 1 - (ch - 48);
    else
      s[i] = 1 - (ch - 48);
    p[i] = ch;
  }
  for (int i = 0; i < n; ++i) {
    if (p[i] == '1') continue;
    int l = 0, r = n;
    while (l < r) {
      int mid = (l + r) / 2;
      int l1 = max(i - mid, 0), l2 = min(i + mid, n - 1);
      bool flag = false;
      if (l1 == 0)
        flag = s[l2] - 1 >= k;
      else
        flag = (s[l2] - s[l1 - 1] - 1) >= k;
      if (flag)
        r = mid;
      else
        l = mid + 1;
    }
    ans = min(ans, l);
  }
  cout << ans << endl;
  return 0;
}
