R220794804 记录详情
#include<bits/stdc++.h>
using namespace std;
int a[1001],b[10001];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,w;
cin>>n>>w;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=1;i<=w;++i){
b[i]=INT_MAX;
for(int j=1;j<=n;++j){
if(i-a[j]>=0) b[i]=min(b[i],b[i-a[j]]+1);
}
}
cout<<b[w];
return 0;
}