#include <bits/stdc++.h>
#define X first
#define Y second
#define PB push_back
#define ll long long
#define pii pair<ll,ll>
#define MEM(x,y) memset(x,y,sizeof(x))
#define bug(x) cout<<"debug "#x" is "<<x<<endl;
#define FIO ios::sync_with_stdio(false);
#define ALL(x) x.begin(),x.end()
#define LOG 20
#define lson(x) ((x)<<1)
#define rson(x) ((x)<<1|1)
int a[3010];long long dp[3010];
const int mod=998244353;
int main()
{
	int n,s;
	cin>>n>>s;
	for(int i=1;i<=n;i++) 
		scanf("%d",&a[i]);
    long long ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=s-a[i];j>=0;j--)
			dp[j+a[i]]=(dp[j+a[i]]+dp[j])%mod;
		dp[a[i]]+=i;
		ans=(ans+dp[s])%mod;
	}
    printf("%lld\n",ans);
    return 0;
}