#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 ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 998244353
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF INT_MIN 
#define INF INT_MAX 
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 
int ar[3001];bool vis[3001][3001];vector<vector<VI>>re(3001,vector<VI>(3001));
int n,s;
void solve(int i,int sum)
{  
    if(i==n)return;
    if(vis[i][sum]==false)
    {   vis[i][sum]=true;
        solve(i+1,sum);
        for(auto it:re[i+1][sum])re[i][sum].pb(it);
        for(int j=i;j<n;j++)
        {   if(sum-ar[j]>0){
            solve(j+1,sum-ar[j]);
            for(auto it:re[j+1][sum-ar[j]])re[i][sum].pb(it);
        }
        else if(sum==ar[j])re[i][sum].pb(j);
        }
    }
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{//cout<<"Case #"<<T1<<":"<<' '; 
   
   cin>>n>>s;
   for(int i=0;i<n;i++)cin>>ar[i];
   int anss=0;
   for(int i=0;i<n;i++)
   {  if(s-ar[i]>0)
       {solve(i+1,s-ar[i]);
        for(auto it:re[i][s]){anss+=(i+1)*(n-it);anss%=anss;}
       }
       else if(s==ar[i]){anss+=(i+1)*(n-i);anss%=mod;}
   }
   cout<<anss<<endl;
}


return 0;
}



