// https://dashoj.com/p/114
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
vector<int> dp(m + 1, 1e5);
dp[0] = 0;
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
if (a[j] <= i) dp[i] = min(dp[i], dp[i - a[j]] + 1);
cout << dp[m] << endl;
return 0;
}
0 回复
0 转发
0 喜欢
1 阅读



