func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 10;   const int maxm = 1e5 + 10;   const int INF = 0x3f3f3f3f;   const long long LINF = 3e17 + 1;   const int mod = 998244353;   int n, m, eid, sz;   inline int read() {     register int x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = (x << 3) + (x << 1) + ch -  0 ;       ch = getchar();     }     return (f == 1) ? x : -x;   }   int a[maxn];   int main() {     ;     ios::sync_with_stdio(0);     cin.tie(0);     ;     int r;     cin >> n >> r;     for (int i = 1; i <= n; i++) cin >> a[i];     int cur = 1, res = 0;     while (cur <= n) {       int idx = 0;       for (int i = 1; i <= n; i++) {         if (a[i]) {           if (cur >= i - r + 1 && cur <= i + r - 1) {             idx = i;           }         }       }       if (idx == 0) {         cout << -1 << endl;         return 0;       }       res++;       cur = idx + r;     }     cout << res << endl;     return 0;   }   