#include <bits/stdc++.h>
#define M 998244353
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define d(x) cout << #x << " " << x << "\n";
#define min(x1, x2) (x1 > x2 ? x2 : x1)
#define max(x1, x2) (x1 < x2 ? x2 : x1)
#define min3(x1, x2, x3) (x3 > min(x1, x2) ? min(x2, x1) : x3)
#define max3(x1, x2, x3) (x3 < max(x1, x2) ? max(x1, x2) : x3)
#define ll long long int
#define ul unsigned long long int
#define p pair<ll, ll>
#define ld long double
#define dv(v)                            \
    cerr << #v << "  ";                  \
    for (int i = 0; i < (v).size(); i++) \
        cerr << v[i] << " ";             \
    cerr << "\n";
#define inf INT_MAX
#define mp(x, y) make_pair(x, y)
using namespace std;
ll n, m;
vector<ll> fact;
void fac(ul n)
{
    fact.resize(n + 1);
    fact[0] = 1;
    for (ul i = 1; i <= n; ++i)
    {
        fact[i] = (fact[i - 1] * i) % M;
    }
}
long long power(long long a, long long b)
{
    if (b == 0)
    {
        return 1;
    }
    long long res = power(a, b / 2);
    if (b % 2)
    {
        return (res * res) % M * a % M;
    }
    else
    {
        return res * res % M;
    }
}

long long flt(long long a)
{
    return power(a, M - 2);
}
ll ncr(ll n, ll i)
{
    if (n < i)
        return 0;
    return ((fact[n] * flt(fact[i])) % M * flt(fact[n - i])) % M;
}

int main()
{
    fio;
    ll t, x, y, z, k;
    vector<ll> v;
    string s;
    cin >> n >> m;
    vector<ll> dp(m + 1);
    vector<ll> ndp(m + 1);
    fac(n);
    ll ans = 0;
    for (int i = 1; i <= m; ++i)
    {
        dp[i] = 1;
        ans = (ans + 1) % M;
    }
    bool b = 1;
    ll sum;
    int l = 1;
    while (l + 1 <= n)
    {
        sum = 0;
        ndp.assign(m + 1, 0);
        b = 0;
        for (int j = 1; j <= m; ++j)
        {
            if (dp[j] == 0)
            {
                continue;
            }
            for (int i = 2 * j; i <= m; i += j)
            {
                b = 1;
                ndp[i] = (ndp[i] + dp[j]) % M;
            }
        }
        if (!b)
        {
            break;
        }
        ++l;
        dp = ndp;
        for (int j = 1; j <= m; ++j)
        {
            sum = (sum + dp[j]) % M;
        }
        ans = (ans + (ncr(n - 1, l - 1) * sum) % M) % M;
    }
    cout << ans << "\n";
    return 0;
}
#include <bits/stdc++.h>
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(w, n) FOR(w, 0, n)
using namespace std;
typedef long long ll;

const int MOD = 998244353;

long long kai[101];
void kaijo()
{
	kai[0] = 1;
	FOR(i, 1, 100)
	{
		kai[i] = i * kai[i - 1];
		kai[i] %= MOD;
		// cout << kai[i] << endl;
	}
}
int main()
{
	int n;
	cin >> n;
	ll dp[110][5100] = {};
	ll total = 0;
	vector<ll> a(n);
	kaijo();
	REP(i, n)
	{
		cin >> a[i];
		total += a[i];
	}
	if (total % 2)
	{
		cout << 0 << endl;
		return 0;
	}
	total /= 2;
	// cout << total << endl;
	dp[0][0] = 1;
	REP(i, n)
	{
		for (int k = n; k >= 0; k--)
		{
			REP(j, 5050)
			{
				if (j + a[i] <= 5050)
				{
					dp[k + 1][j + a[i]] += dp[k][j] % MOD;
					dp[k + 1][j + a[i]] %= MOD;
				}
			}
		}
	}
	// cout << dp[1][1] << endl;
	ll ans = 0;
	REP(i, n)
	{
		// ans += dp[i][total];
		// cout << dp[i][total] << endl;
		ans += ((dp[i][total] * kai[i] % MOD) * kai[n - i] % MOD);
		ans %= MOD;
	}
	cout << ans << endl;
	return (0);
}
