/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 1844674407370955161
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define max_heap priority_queue<int>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    if(a.ss < b.ss) return true; 
    else if(a.ss==b.ss) return a.ff<b.ff;
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else return false;
} 
bool sortff_resortss(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else if(a.ff==b.ff) return a.ss>b.ss;
	else return false;
}
bool sortbystring(const string &a, const string &b)
{
	string c=a+b;
	string d=b+a;
	if(c>=d) return true;
	else return false;
}

ll modi(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
ll Logn(ll  n, ll r) 
{ 
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

bool** dp; 
  
//void display(const vector<pair<int,int>>& v) 
//{ 
////	cout<<"display"<<endl;
//    for (int i = 0; i < v.size(); ++i) 
//        printf("%d ", v[i].ff); 
//    printf("\n"); 
//} 
  
ll sum1=0;
void printSubsetsRec(vector<pair<int,int>> &arr, int i, int sum, vector<pair<int,int>>& p) 
{ 
    if (i == 0 && sum != 0 && dp[0][sum]) 
    { 
        p.push_back({arr[i].ff,arr[i].ss}); 
//        display(p); 
		int r1=p[0].ss;
		int r2=p[p.size()-1].ss;
		ll left=r2;
		ll right=(arr.size()-r1-1);
//		cout<<1000<<" "<<left<<" "<<right<<endl;
		sum1+=(left*right);
		sum1%=Mod;
		sum1++;
		sum1%=Mod;
		sum1+=left;
		sum1%=Mod;
		sum1+=right; 
		sum1%=Mod;
        return; 
    } 
    if (i == 0 && sum == 0) 
    { 
//        display(p);
		
		int r1=p[0].ss;
		int r2=p[p.size()-1].ss;
//		cout<<10000<<" "<<r1<<" "<<r2<<endl;
		ll left=r2;
		ll right=(arr.size()-r1-1);
//		cout<<10000<<" "<<left<<" "<<right<<endl;
		sum1+=(left*right);
		sum1%=Mod;
		sum1++;
		sum1%=Mod;
		sum1+=left;
		sum1%=Mod;
		sum1+=right; 
		sum1%=Mod;
        return; 
    } 
    if (dp[i-1][sum]) 
    { 
        vector<pair<int,int>> b = p; 
        printSubsetsRec(arr, i-1, sum, b); 
    } 
    if (sum >= arr[i].ff && dp[i-1][sum-arr[i].ff]) 
    { 
        p.push_back({arr[i].ff,arr[i].ss}); 
        printSubsetsRec(arr, i-1, sum-arr[i].ff, p); 
    } 
} 
void printAllSubsets(vector<pair<int,int>>  &arr, int n, int sum) 
{ 
    if (n == 0 || sum < 0) 
       return; 
    dp = new bool*[n]; 
    for (int i=0; i<n; ++i) 
    { 
        dp[i] = new bool[sum + 1]; 
        dp[i][0] = true; 
    } 
    if (arr[0].ff <= sum) 
       dp[0][arr[0].ff] = true; 
    for (int i = 1; i < n; ++i) 
        for (int j = 0; j < sum + 1; ++j) 
            dp[i][j] = (arr[i].ff <= j) ? dp[i-1][j] || 
                                       dp[i-1][j-arr[i].ff] 
                                     : dp[i - 1][j]; 
//    if (dp[n-1][sum] == false) 
//    { 
//        printf("There are no subsets with sum %d\n", sum); 
//        return; 
//    } 
    vector<pair<int,int>> p; 
    if(dp[n-1][sum]==false)
    return;
    printSubsetsRec(arr, n-1, sum, p); 
}  
int main()
{
	FAST
	int t=1;
//	cin>>t;
	while(t--)
	{	
		int n,k;
		cin>>n>>k;
		vector<pair<int,int>> a(n);
		for(int i=0;i<n;i++){
			cin>>a[i].ff;
			a[i].ss=i;
		}
//		ll sum=0;
		printAllSubsets(a,n,k);
		cout<<sum1;
	}
	return 0;
}














