#include <bits/stdc++.h>
using namespace std;

int quadri(int N, long long M, int V[]) {

    vector<int> V2(N);
    for (int i = 0; i < N; ++i) {
        V2[i] = V[i];
    }
    sort(V2.begin(), V2.end());

    int B = 0;
    int currentSum = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (currentSum + V2[i] <= M) { // OCIO QUI SE NON PASSA
            currentSum += V2[i];
            B++;
            continue;
        }
        break;
    }

    return B;
}
