#include <numeric>
using namespace std;

int quadri(int N, long long M, int V[]) {
    // Scrivete qui la vostra soluzione
    long long somma = 0;
    bool v = false;
    for(int a = N; a >= 1; a--){
        v = true;
        somma = accumulate(V, V + a, 0LL);
        if(somma <= M){
            for(int b = 0; b + a <= N; b++){
                somma = accumulate(V + b, V + b + a, 0LL);
                if(somma <= M){
                    v = true;
                } else{
                    v = false;
                    break;
                }
            }
            if(v){
                return a;
            }
        } else{
            continue;
        }
    }
    return a;
}


