#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
//const ll MOD=1000000007;
const ll MOD=998244353;

ll sum[3030],A[3030];
ll dp[3030][3030];

int main(){
  int N,S; cin>>N>>S;
  rep(i,N){
    cin>>A[i];
    sum[i+1]=sum[i]+A[i];
  }
  dp[0][0]=1;
  rep(i,N) rep(j,S+1){
    (dp[i+1][j]+=dp[i][j])%=MOD;
    if(j+A[i]<=S) (dp[i+1][j+A[i]]+=dp[i][j])%=MOD;
  }
  ll ans=0;
  rep(i,N) for(int j=i;j<N;j++){
    (ans+=dp[j+1][S])%=MOD
    ans=(ans-dp[i][S]+MOD)%MOD;
  }
  cout<<ans<<endl;
  return 0;
}