#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n,m;cin>>n>>m; vcv(n); rep(i,n)cin>>v[i]; sort(all(v)); vc dp(n,vc(m+1,-1e18)); dp[0][0]=0; rep(i,n-1){ dp[i+1]=dp[i]; ll x=v[i+1]-v[i]; if(i)rep(j,m+1)if(j+x<=m)dp[i+1][j+x]=max(dp[i+1][j+x],dp[i-1][j]+v[i+1]); if(!i)if(x<=m)dp[i+1][x]=v[i+1]; } ll ans=0; rep(i,m+1)ans=max(ans,dp[n-1][i]); cout<