#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
set<ll> solve(vl A) {
	int N = sz(A);
	set<ll> res;
	F0R(m, 1 << N) {
		ll cur = 0;
		F0R(i, N) {
			if (m & (1 << i)) {
				cur += A[i];
			}
		}
		res.ins(cur);
	}
	return res;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int N; cin >> N; ll T; cin >> T;
	ll A[N]; F0R(i, N) cin >> A[i];
	int bp = N / 2;
	vl B, C;
	F0R(i, N / 2) B.pb(A[i]);
	FOR(i, N / 2, N) C.pb(A[i]);
	set<ll> X = solve(B), Y = solve(C);

	ll ans = T;
	trav(a, X) {
		auto it = Y.ub(T - a);
		if (it == Y.begin()) break;
		it--;
		ckmin(ans, T - a - *it);
	}
	cout << T - ans << nl;
	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


/*
 * @Author: BilyHurington
 * @Date: 2021-06-28 08:39:58
 * @LastEditors: BilyHurington
 * @LastEditTime: 2021-06-28 08:47:18
 */
#include<bits/stdc++.h>
#ifdef LOCAL_TEST
#include<ctime>
#endif
using namespace std;
int n,w[110],f[110][5010],Fac[110];
const int mod=998244353;
void Add(int &x,int y){x+=y;x-=x>=mod?mod:0;}
int main(){
    #ifdef LOCAL_TEST
    clock_t start=clock();
    #endif
    scanf("%d",&n);int sum=0;Fac[0]=1;
    for(int i=1;i<=n;i++) Fac[i]=1ll*Fac[i-1]*i%mod;
    for(int i=1;i<=n;i++) scanf("%d",&w[i]),sum+=w[i];
    if(sum&1){puts("0");return 0;}
    sum/=2;f[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=sum;j>=w[i];j--){
            for(int k=1;k<=n;k++){
                Add(f[k][j],f[k-1][j-w[i]]);
            }
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++) Add(ans,1ll*Fac[i]*Fac[n-i]%mod*f[i][sum]%mod);
    printf("%d",ans);
    #ifdef LOCAL_TEST
    clock_t end=clock();cout<<endl;
    cout<<"The program costs "<<(double)(end-start)/CLOCKS_PER_SEC<<" seconds"<< endl;
    puts("");system("pause");
    #endif
    return 0;
}