func_code_string: #include <bits/stdc++.h>   using namespace std;   const double EPS = 1e-9;   const int INF = 2147483647;   const long long LLINF = 9223372036854775807LL;   template <class T>   T gcd(T a, T b) {     if (a < b) swap(a, b);     if (b == 0) return a;     return gcd(b, a % b);   }   template <class T>   T lcm(T a, T b) {     return (a * b) / gcd(a, b);   }   int dp[510001];   int main() {     int d, n;     cin >> n >> d;     vector<int> c(n);     for (int i = 0; i < (n); i++) cin >> c[i];     for (int i = 0; i < (n); i++) {       for (int j = (510000); j >= (c[i]); j--) {         dp[j] = max(dp[j], c[i] + dp[j - c[i]]);       }     }     int ans = 0, lAns = -1, days = -1;     while (ans != lAns) {       lAns = ans;       ans = dp[ans + d];       days++;     }     if (ans == 0)       cout << 0 <<     << 0 << endl;     else       cout << ans <<     << days << endl;     return 0;   }   