#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<int> vll;
typedef pair<int, int> pii;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define INF 1000000007LL
#define MOD 998244353LL

const int LIM = 2e5 + 5;

void solve()
{
    int n;
    cin >> n;
    vi v(n);
    for(auto& i : v)
        cin >> i;
    sort(ALL(v));
    reverse(ALL(v));
    ll ways = 1;
    for(int i = 1; i < n; i++)
    {
        ll p = v[i - 1] - v[i] + 1;
        ways = ways * p % INF;
    }    
    ways = ways * (v[n - 1] + 1) % INF;
    cout << ways << '\n';
}

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

    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int MOD = 998244353;
int N=3141, M=2718;
long comblist[6000];
long result[6000];

long fastpow(long a, int p){
    long ans = 1;
    while(p>0){
        if (p%2==1)
            ans = ans * a % MOD;
        p >>= 1;
        a = a * a % MOD;
    }
    return ans;
}
long fastinv(long a){
    return fastpow(a, MOD - 2);
}

void preparecomb(){
    comblist[0] = 1;
    for (int i = 1; i <= N ; i++)
    {
        comblist[i] = comblist[i - 1] * (N - i + 1) % MOD * fastinv(i) % MOD;
    }
    
}

void print(auto x){
    cout << x << endl;
}


long solve2(){
    //result[i] == f(2i)
    result[0] = 1;
    result[1] = comblist[2];
    int i = 2;
    while(2*i<=M){
        for (int j = i>>1;j>=0&&2*(i-2*j)<=N; j--){
            
            result[i] += result[j] * comblist[2*(i-2*j)] % MOD;
        result[j] %= MOD;}
        i++;
    }
    return result[M / 2] % MOD;
}


int main2()
{
    cin >> N >> M;
    
    if (N == 1 || M % 2 == 1)
    {
        print(0);
        return 0;
    }
    if (N==2){
        print(1);
        return 0;
    }
    preparecomb();
    print(solve2());
    return 0;
}

int main(){
    while(true){
        main2();
        break;
    }
}