#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n,w;
//freopen("mountain.in","r",stdin);
//freopen("mountain.out","w",stdout);
cin>>n>>w;
int cnt=0;
multiset<int> se;
for (int i=0;i<n;i++) {
int x;
cin>>x;
se.insert(x);
}
while (!se.empty()) {
int x=*se.begin();
se.erase(se.begin());
int sum=x;
auto it=se.upper_bound(w-sum);
while (it!=se.begin()){
it=se.upper_bound(w-sum);
if (it!=se.begin()) {
it--;
sum+=*it;
se.erase(it);
}
}
cnt++;
}
cout<<cnt;
//fclose(stdin);
//fclose(stdout);
return 0;
}