#include #include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template vector> vec2d(int n, int m, T v){ return vector>(n, vector(m, v)); } template vector>> vec3d(int n, int m, int k, T v){ return vector>>(n, vector>(m, vector(k, v))); } template void print_vector(vector v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } const ll INF = 1e+15; typedef pair P; struct edge{ int to; ll cost; }; vector dijkstra(int s, vector> G){ priority_queue, greater

> que; int n = G.size(); vector d(n, INF); d[s] = 0; que.push(P(0, s)); while(!que.empty()){ P p = que.top();que.pop(); int v = p.second; if(d[v] < p.first) continue; for(int i = 0; i < G[v].size(); i++){ edge e = G[v][i]; if(d[v] + e.cost < d[e.to]){ d[e.to] = d[v] + e.cost; que.push(P(d[e.to], e.to)); } } } return d; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int n; ll l; cin >> n >> l; vector w(n); for(int i = 0; i < n; i++) cin >> w[i]; vector> g(w[0]); for(int i = 1; i < n; i++){ for(int j = 0; j < w[0]; j++){ int k = (j+w[i])%w[0]; g[j].push_back(edge{k, w[i]}); } } auto d = dijkstra(0, g); // print_vector(d); ll ans = l; for(int i = 1; i < w[0]; i++){ if(d[i] > l){ if(l%w[0] >= i) { ans -= l/w[0]+1; } else { ans -= l/w[0]; } }else{ // debug_value(i) ans -= d[i]/w[0]; } } cout << ans << endl; }