#include<bits/stdc++.h>usingnamespace std;constint N =20;int n, m;int w[N], sum[N];int ans =0x3f3f3f3f;boolcmp(int a,int b){return a > b;}voiddfs(int u,int len){if(len > ans)return;if(u == n){
ans =min(ans, len);return;}bool flag =true;for(int i =0; i < len; i ++){if(w[u]+ sum[i]<= m){
sum[i]+= w[u];
flag =false;dfs(u +1, len);
sum[i]-= w[u];
flag =true;}}if(flag){
sum[len]+= w[u];dfs(u +1, len +1);
sum[len]-= w[u];}}intmain(){
cin >> n >> m;for(int i =0; i < n; i ++) cin >> w[i];sort(w, w + n, cmp);dfs(0,0);
cout << ans;return0;}