#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    vector<int> a;
    while (~scanf("%d%d", &n, &m))
    {
        for (int i = 0, x; i < n; i++)
            scanf("%d", &x), a.push_back(x);
        sort(a.begin(), a.end(), greater<int>());
        int ans = 0;
        while (a.size())
        {
            int res = m;
            for (int i = a.size() - 1; i >= 0; i--)
                if (a[i] <= res) res -= a[i], a.erase(a.begin() + i);
            ans++;
        }
        printf("%d\n", ans);
    }
    return 0;
}
