#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;

using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vpll = vector<pair<ll, ll>>;
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define pb push_back
#define endl '\n'
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);
const int inf = 1<<30;
const ll INF = 1ll<<60;
const ll mod = 1000000007;
//const ll mod = 998244353;
//const ll dx[4] = {1, 0, -1, 0};
//const ll dy[4] = {0, 1, 0, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class T> void disp1(vector<T> &array, bool blank=1) {
    rep(i, array.size()) cout << ((i&&blank) ? " " : "") << array[i];
    cout << endl;
    //cout << " ";
}
template<class T> void disp2(vector<vector<T>> &array, bool blank=1) {
    rep(i, array.size()) disp1(array[i], blank);
}

ll rem(ll a, ll b) { return (a % b + b) % b; }      // 余りを0~b-1に丸める
// 小数の入力が文字で与えられたとき、10^n倍したものを返す
ll x10(string str_f, ll n) {
    if (str_f[0] == '-') return -x10(str_f.substr(1), n);
    ll times = 1; rep(i,n) times *= 10;     // times = 10^n
    int id = -1; rep(i,str_f.size()) if (str_f[i] == '.') id = i;
    if (id == -1) { return stoll(str_f)*times; }
    string str_int = str_f.substr(0, id), str_dec = str_f.substr(id+1);
    while (str_dec.size() < n) str_dec += '0';
    return stoll(str_int)*times + stoll(str_dec);
}
// A^N (mod)
ll modpow(ll A, ll N, ll mod) {
    ll RES = 1;
    while (N) {
        if (N & 1) RES = RES * A % mod;
        A = A * A % mod;
        N >>= 1;
    }
    return RES;
}

//using mint = modint1000000007;

ll dp[105][105][105];

int main() {
    ll n, x; cin >> n >> x;

    vll a(n); rep(i,n) cin >> a[i];
    ll ans = INF;
    for (int c = 1; c <= n; c++) {
        vvvll dp(n+1, vvll(n+2, vll(c, -INF)));
        dp[0][0][0] = 0;
        rep(i,n) {
            rep(j,n+1) {
                rep(k,c) {
                    // a[i]を使う
                    chmax(dp[i+1][j+1][(k+a[i])%c], dp[i][j][k]+a[i]);
                    // a[i]を使わない
                    chmax(dp[i+1][j][k], dp[i][j][k]);
                }
            }
        }
        // dp[n][c][x%c]
        //disp2(dp[n]);
        //cout << dp[n][c][x%c] << endl;
        if (dp[n][c][x%c] > 0) chmin(ans, (x-dp[n][c][x%c])/c);
        //cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}
#include<algorithm>
#include<iostream>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ll
#define ll long long
#define reg register
#define db double
#define il inline
#define gc getchar
#define pc putchar
#define HgS 998244353
il ll rd()
{
	reg ll res=0,lab=1;
	reg char ch=gc();
	while((ch<'0'||ch>'9')&&ch!=EOF)
	{if(ch=='-')lab=-lab;ch=gc();}
	while(ch>='0'&&ch<='9')
		res=(res<<3)+(res<<1)+(ch&15),ch=gc();
	return res*lab;
}
il void prt(ll x,char t='\n')
{
	reg char ch[70];reg int tp=0;
	if(x<0)pc('-'),x=-x;
	while(x)ch[++tp]=(x%10)^48,x/=10;
	if(!tp)ch[++tp]=48;
	while(tp)pc(ch[tp--]);
	if(t)pc(t);
}
ll n,a[200005],ans,tmp;
//il ll qpow(ll n,ll e=HgS-2,ll p=HgS)
//{
//	reg ll res=1;
//	while(e)
//	{
//		if(e&1)res=res*n%p;
//		n=n*n%p;e>>=1;
//	}
//	return res;
//}
int main()
{
	n=rd();for(int i=1;i<=n;++i)a[i]=rd();
	sort(a+1,a+1+n);
	for(int i=n;i>=1;--i)
	{
		tmp=((tmp<<1)%HgS+a[i]-a[i+1]+HgS)%HgS;
		ans=(ans+a[i]*tmp)%HgS;
//		cerr<<a[i]<<' '<<tmp<<endl;
	}
	prt(ans);
	return 0;
}
