#include #include #include #include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) int N; i64 L; int Z; vector W; vector dp; int main() { cin >> N; cin >> L; W.resize(N); rep(i,N) cin >> W[i]; sort(W.begin(), W.end()); Z = W.back(); W.pop_back(); dp.assign(Z, Z+100); dp[0] = 0; deque queues = {0,0}; while(queues.size()){ int p = queues.back(); queues.pop_back(); int pred = queues.back(); queues.pop_back(); if(dp[p] != pred) continue; for(i64 w : W){ int nxp = (p + w); int nxd = pred; if(nxp >= Z){ nxp -= Z; nxd++; } if(dp[nxp] <= nxd) continue; dp[nxp] = nxd; if(nxd == pred){ queues.push_back(nxd); queues.push_back(nxp); } else{ queues.push_front(nxp); queues.push_front(nxd); } } } i64 ans = L; rep(i,Z){ i64 U = (L + Z - i) / Z; if(i == 0) U--; i64 dpi = dp[i]; if(dpi >= Z) dpi = L; ans -= min(U, dpi); } cout << ans << endl; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;