//bismillahir rahmanir rahim            //Author:Fayed Anik
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
//#define         ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define         ll                          long long
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         UNIQUE(v)                   v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define         mod                         1000000007
#define         INF                         2e18
#define         EPS                         1e-15
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
#define         FASTREAD                    ios_base::sync_with_stdio(0);cin.tie(nullptr);
#define         endl                        "\n"
 
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;
//int dx[]={0,0,1,-1,1,1,-1,-1};
//int dy[]={1,-1,0,0,1,-1,1,-1};
 

ll a[45];
 
int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    FASTREAD
    ll n,lim,T,now,ans=0,fh,sh;
    cin>>n>>T;
    fh = n/2;
    sh = n/2;
    if( !(n&1) ) fh--;
    if( n&1 ) sh++;
    for(ll i=0;i<n;i++) cin>>a[i];
    vector<ll>fst,sec;
    lim = 1LL<<(fh+1);
    for(ll mask=0;mask<lim;mask++){
        ll sum=0;
        for(ll i=0;i<=fh;i++){
            if( CHECK(mask,i) ) sum += a[i];
        }
        if( sum<=T ) ans = max(ans,sum);
        fst.pb(sum);
    }
    lim = 1LL<<(n-sh);
    for(ll mask=0;mask<lim;mask++){
        ll sum=0;
        for(ll i=sh;i<n;i++){
            if( CHECK(mask,i-sh) ) sum += a[i];
        }
        if( sum<=T ) ans = max(ans,sum);
        sec.pb(sum);
    }
    sort(all(sec));
    for(ll i=0;i<fst.size();i++){
        ll rem = T-fst[i];
        if( rem<0 ) continue;
        now = fst[i];
        ll lw=0,hi=sec.size()-1,mid,pos=-1;
        while(lw<=hi){
            mid=(lw+hi)/2;
            if( sec[mid]<=rem ){
                pos = mid;
                lw = mid+1;
            }
            else{
                hi = mid-1;
            }
        }
        if( pos!=-1 ) now += sec[pos];
        ans = max(ans,now);
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 55;



int n; ll x;
ll a[maxn];
ll b[maxn];
ll k[maxn];

ll dp[maxn][2];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);


    cin>>n>>x;

    for (int i=1; i<=n; i++) {
	cin>>a[i];
    }

    for (int i=1; i<n; i++) {
	b[i] = a[i+1]/a[i];
    }


    for (int i=n; i>=1; i--) {
	k[i] = x/a[i];
	x %= a[i];
    }

    if (n==1) {
	out(1);
    }


    dp[1][0] = 1;
    if (k[1]!=0) {
	dp[1][1] = 1;
    }

    for (int i=2; i<n; i++) {
	dp[i][0] = dp[i-1][0];
	if (k[i]!=0) { //use a[i] in remainder, initiate carrying
	    dp[i][1] += dp[i-1][0];
	}
	if (k[i]!=b[i]-1) { // let the previous carrying end here
	    dp[i][0] += dp[i-1][1];
	}
	dp[i][1] += dp[i-1][1];
    }

    cout<<(dp[n-1][0]+dp[n-1][1])<<endl;    
    return 0;
}
