func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void read(T &x) {     x = 0;     char ch;     while (!isdigit(ch = getchar()))       ;     do {       x = 10 * x + ch -  0 ;     } while (isdigit(ch = getchar()));   }   const int N = 3e6 + 111;   const int INF = 1e9;   int n, q, D[N], res;   long long A[N], F[N];   bool vst[N];   template <typename T>   inline bool mini(T &x, T y) {     if (x > y)       x = y;     else       return 0;     return 1;   }   template <typename T>   inline bool maxi(T &x, T y) {     if (x < y)       x = y;     else       return 0;     return 1;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     read(n);     read(q);     for (int i = 1; i <= n; i++) {       read(A[i]);     }     for (int i = n + 1; i <= 3 * n; i++) {       A[i] = A[i - n];     }     for (int i = 1; i <= 3 * n; i++) {       F[i] = F[i - 1] + A[i];     }     while (q--) {       long long x;       read(x);       int j = 0;       for (int i = 1; i <= 3 * n; i++) {         while (F[i] - F[j] > x) j++;         D[i] = i - j;       }       int k = INF;       int p;       for (int i = 2 * n + 1; i <= 3 * n; i++) {         if (mini(k, D[i])) {           p = i;         }       }       if (k >= n) {         cout << 1 <<   n ;         continue;       }       res = INF;       for (int r = p - D[p]; r <= p; r++) {         int l = r - n + 1;         int i = r;         int cnt = 0;         while (i >= l) {           cnt++;           i -= D[i];         }         mini(res, cnt);       }       cout << res <<   n ;     }     return 0;   }   