#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll mod=1000000007;

int main(){
  int n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  ll ans=1;
  for(int i=0;i<n-1;i++){
    ans*=(a[i+1]-a[i]+1);
    ans%=mod;
  }
  ans*=(a[0]+1);
  ans%=mod;
  cout<<ans<<endl;
  return 0;
}

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 998244353; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

class binomial_coefficients {
	long long MAX_VAL;
	vector<long long> fac, mmi;

public:

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD) if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = (x%MOD + MOD) % MOD;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};



signed main(){
	cout<<fixed<<setprecision(10);
	
	binomial_coefficients BC;
	int N, M;
	static int dp[5100][20];
	int ans = 0;
	
	cin>>N>>M;
	
	BC.init(N + M);
	
	dp[0][0] = 1;
	
	for(int i = 0; i < 16; i++){
		int X = 1, Y = (1<<(i+1));
		for(int j = 0; j <= M; j += X){
			for(int k = 0, l = 0; j+k <= M; k += Y, l += 2){
				dp[j+k][i+1] += dp[j][i] * BC.combination(N, l) % MOD;
				dp[j+k][i+1] %= MOD;
			}
		}
	}
	
	cout<<dp[M][16]<<endl;
	
	
	return 0;
}