8pt
#include<iostream>
#include<algorithm>
using namespace std;
int n,w,ans;
int c[100],v[100];//v:car
void dfs(int x,int y){//x:cat y:car
if(y>=ans){return;}
if(x==n){ans=y;}
for(int i=1;i<=y;i++){
if(v[i]+c[x]<=w){
v[i]+=c[x];
dfs(x+1,y);
v[i]-=c[x];
}
}
v[y]=c[x];
dfs(x+1,y+1);
v[y]=0;
}
bool cmp(int x,int y){
return x>y;
}
int main(){
cin >> n >> w;
ans=n;
for(int i=1;i<=n;i++){
cin >> c[i];
}
sort(c+1,c+n+1,cmp);
dfs(0,0);
cout << ans;
return 0;
}