#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll ans=0,MD=998244353,n;
ll vis[3005][3005],dp[3005][3005],a[3005];


ll solve(ll idx,ll sum)
{
	if(idx==n)
	{
		if(sum==a[idx])
		{
			// ans=(ans+idx)%MD;
			return idx-1;
		}
		return 0;
	}
	if(vis[idx][sum])
		return dp[idx][sum];
	vis[idx][sum]=1;
	ll x=0,y=0;
	x=(solve(idx+1,sum))%MD;
	y=(solve(idx+1,sum-a[idx]))%MD;
	ans=(ans+(idx*y)%MD)%MD;
	if(a[idx]==sum)
		x=(x+n-idx+1)%MD;
	return dp[idx][sum]=(x+y)%MD;
}

int main()
{
    ios_base::sync_with_stdio(false);
	ll i,j,k,x,y,t,m,s;

	x=0;
	cin >> n >> s;
	for(i=1;i<=n;i++)
	{
		cin >> a[i];
		if(a[i]==s)x++;
	}

	cout<<(x+solve(1,s))%MD<<endl;
}