#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL sum;
int a[3010], n, s;
LL dp[3010];
void add(LL &x, LL y){
  x += y;
  if (x >= 998244353) x -= 998244353;
}
int main(){
  	cin>>n>>s;
  	for (int i=1;i<=n;i++) cin>>a[i];
  	sum = 0;
  	now = 0;
  	for (int i=1;i<=n;i++){
        now += a[i];
      	if (now > s) now = s
    	dp[0] = i;
      	if (a[i]>s) continue;
      	add(sum, dp[s-a[i]] * (n-i+1)); 
      	for (int j=now-a[i]; j>=0; j--) add(dp[j+a[i]], dp[j]);
    }
  	cout<<sum<<endl;
	return 0;
}
