#include <bits/stdc++.h>
//#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1e18;
//const ll mod = 1000000007;
ll ans = 0;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    vector<ll> A[2];
    vector<ll> sum[2];
    cin >> N;
    ll T;
    cin >> T;
    for(int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A[i%2].push_back(a);
    }
    for(int i = 0; i < 2; i++) {
        for(int bits = 0; bits < (1 << A[i].size()); bits++) {
            ll tmp = 0;
            for(int j = 0; j < A[i].size(); j++) {
                if(bits & (1 << j)) tmp += A[i][j];
            }
            sum[i].push_back(tmp);
        }
        sort(sum[i].begin(), sum[i].end());
    }
    for(auto tmp : sum[0]) {
        auto itr = lower_bound(sum[1].begin(), sum[1].end(), T+1-tmp);
        if(itr == sum[1].begin()) continue;
        itr--;
        chmax(ans, tmp + *itr);
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0);ios_base::sync_with_stdio(0);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cout << endl; }
void show() { cout << endl; }
void pret() { cout << endl; exit(0);}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cout << " " << to_string(H); debug_out(T...);}
template <typename Head, typename... Tail> void show(Head H, Tail... T) {cout <<H<<" "; show(T...);}
template <typename Head, typename... Tail> void pret(Head H, Tail... T) {cout <<H<<" "; pret(T...);}
#define pr(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
#define disp(x) cout<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(int)b;i++)
#define fo(i,a,b) for(int i=a;i<=(int)b;i++)
#define rf(i,a,b) for(int i=a;i>=(int)b;i--)
#define mp make_pair
#define pb emplace_back
#define F first
#define S second
#define endl '\n'
//cout.setf(ios::fixed);cout.precision(18)
const int MOD = 1e9+7;
int maxn = 100+1;

int dp[101][101][101];
int newdp[101][101][101];

int32_t main(){
    fast_io;
    int n;
    ll x;
    cin >> n >> x;
    maxn = n + 1;
    int a[n + 1];
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i + 1];
    }
    for (int i = 0; i < maxn; ++i)
    {
    	for (int j = 0; j < maxn; ++j)
    	{
    		for (int k = 0; k < maxn; ++k)
    		{
    			dp[i][j][k] = -1;
    		}
    	}
    }
    for (int i = 1; i < maxn; ++i)
    {
    	dp[0][i][0] = 0;
    }
    fo(id, 1, n){
    	// pr(dp);
    	for (int i = 0; i < maxn; ++i)
    	{
    		for (int j = 0; j < maxn; ++j)
    		{
    			for (int k = 0; k < maxn; ++k)
    			{
    				newdp[i][j][k] = dp[i][j][k];
    			}
    				
    		}
    	}
    	// show("----- ", id);
    	fo(i, 1, id){
    		fo(dividend, 1, maxn){
    			for (int rem = 0; rem < maxn; ++rem)
    			{
    				if(dp[i - 1][dividend][rem] == -1) continue;
    				int curr = (dp[i - 1][dividend][rem] + a[id]) % dividend;
    				newdp[i][dividend][curr] = max(newdp[i][dividend][curr], dp[i - 1][dividend][rem] + a[id]);
    			}
    		}
    		// for (int rem = 0; rem < maxn; ++rem)
    		// {
    		// 	if(dp[i - 1][rem] == -1) continue;
    		// 	int curr = (dp[i - 1][rem] + a[id]) % i;
    		// 	pr(i, rem);
    		// 	show(newdp[i][curr], dp[i - 1][rem] + a[id]);
    		// 	newdp[i][curr] = max(newdp[i][curr], dp[i - 1][rem] + a[id]);
    		// }
    	}
    	for (int i = 0; i < maxn; ++i)
    	{
    		for (int j = 0; j < maxn; ++j)
    		{
    			for (int k = 0; k < maxn; ++k)
    			{
    				dp[i][j][k] = newdp[i][j][k];
    			}
    			// dp[i][j] = newdp[i][j];
    		}
    	}
    }
    ll ans = x;
    for(ll i = 1; i <= n; i++){
    	int rem = x % i;
    	// show(i, rem, dp[i][i][rem]);
    	if(dp[i][i][rem] == -1) continue;
    	ll flag = dp[i][i][rem];
    	flag = x - flag;
    	// show(flag, flag / i);
    	ans = min(ans, flag / i);
    }
    show(ans);
    return 0;
}