#include <bits/stdc++.h>   using namespace std;   inline void read(int &first) {     first = 0;     while (1) {       char ch = getchar();       if (ch ==     || ch ==   n ) break;       first = first * 10 + ch -  0 ;     }   }   inline void write(int first) {     char wr[12];     int k = 0;     if (!first) ++k, wr[k] =  0 ;     while (first) {       ++k;       wr[k] = char(first % 10 +  0 );       first /= 10;     }     for (int i = k; i >= 1; --i) putchar(wr[i]);   }   const int N = 1e5 + 5;   int n, k, s[N], a[N];   char ch;   bool f(int len) {     for (int i = 1; i <= n; ++i) {       if (!a[i]) continue;       int s1 = s[min(n, i + len)] - s[i - 1];       int s2 = s[i] - s[max(0, i - len - 1)];       if (s1 + s2 - a[i] >= k + 1) return 1;     }     return 0;   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i <= n; ++i)       cin >> ch, s[i] = s[i - 1] + (ch ==  0 ), a[i] = ch ==  0 ;     int l = 1, r = n;     while (r - l > 1) {       int mid = (l + r) >> 1;       if (f(mid))         r = mid;       else         l = mid;     }     if (f(l))       cout << l;     else       cout << r;   }   