#include <bits/stdc++.h>
using namespace std;
const int LGN = 15;
const int MAXN = 5005;
const long long int MOD = 998244353;
long long int fact[MAXN], inv_fact[MAXN], dp[LGN][MAXN];
long long int power(long long int a, int b)
{
	if (b == 0)
	{
		return 1;
	}
	long long int ans = power(a, b/2);
	ans = (ans * ans) % MOD;
	if (b % 2)
	{
		ans = (ans * a) % MOD;
	}
	return ans;
}
void precomp()
{
	fact[0] = 1;
	for (int i = 1; i < MAXN; ++i)
	{
		fact[i] = (fact[i - 1] * i) % MOD;
	}
	inv_fact[MAXN - 1] = power(fact[MAXN - 1], MOD - 2);
	for (int i = MAXN - 2; i >= 0; --i)
	{
		inv_fact[i] = (inv_fact[i + 1] * (i + 1)) % MOD;
	}
}
long long int comb(int n, int r)
{
	if (r > n)
	{
		return 0;
	}
	long long int ans = (fact[n] * inv_fact[r]) % MOD;
	ans = (ans * inv_fact[n - r]) % MOD;
	return ans;
}
int main(int argc, char const *argv[])
{
	precomp();
	int n, m;
	cin>>n>>m;
	for (int i = 0; i <= m; i += 2)
	{
		dp[0][i] = comb(n, i);
	}
	for (int i = 1; i < LGN; ++i)
	{
		int cpow = (1<<i);
		for (int j = 0; j <= m; ++j)
		{
			dp[i][j] = 0;
			for (int k = 0; k * cpow <= j; k += 2)
			{
				dp[i][j] = (dp[i][j] + dp[i - 1][j - (k * cpow)] * comb(n, k)) % MOD;
			}
		}
	}
	cout<<dp[LGN - 1][m]<<"\n";
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0;i < (int)(n);++i)
#define MS(x) memset((x), -1, sizeof((x))) 
#define ALL(x) x.begin(), x.end() 
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 (b<a) { a=b; return 1; } return 0; }
bool is_npos(string::size_type x) { return x == string::npos; }
using PI = pair<int, int>;

#define MOD 1000000007

ll n;
ll a[3010];
ll mat[3010][3010];

ll dp[3010][3010] = {};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> n;
	rep(i, n){
		cin >> a[i];
	}

	for(int i = 1;i <= n;i++){
		for(int j = 0;j < n;j++){
			mat[i][j+1] = (mat[i][j] + a[j]) % i; 
		}
	}

	dp[1][0] = 1;

	ll ans = 0;
	for(int j = 1;j <= n;j++){
		for(int i = n;i >= 1;i--){
			if(j == n){
				ans += dp[i][mat[i][j]];
				ans %= MOD;
			}
			dp[i+1][mat[i+1][j]] += dp[i][mat[i][j]]; 
			dp[i+1][mat[i+1][j]] %= MOD; 
		}
	}

	cout << ans << endl;

	return 0;
}
