#include <bits/stdc++.h>
#define rep(i, a, b) for (long long int i = (a); i < (b); i++)

using namespace std;
using ll = long long int;
using ld = long double;

auto p = [](auto s){
    cout << s << endl;
};

int main() {
    ll N, S;
    cin >> N >> S;

    ll M = 998244353;
    ll ans = 0;
    vector<ll> A(N);
    for (ll i = 0; i < N;i++){
        cin >> A[i];
    }
    map<ll, vector<ll>> k = {};
    rep(i, 0, N){
        ll a = A[i];
        if (a == S){
            ans += (i + 1) * (N - i);
            ans %= M;
        }else{
            int comp = S - a;
            if (k.count(comp) > 0){
                vector<ll> js = k[comp];
                for (ll j : js){
                    ans += (j + 1) * (N - i);
                    ans %= M;
                }
            }
            map<ll, vector<ll>> nk = {};
            for(pair<ll, vector<ll>> p: k){
                if (p.first + a < S){
                    nk[p.first + a] = vector<ll>();
                    for (ll l: p.second){
                        nk[p.first + a].emplace_back(l);
                    }
                }
            }
            if(nk.count(a) == 0){
                nk[a] = vector<ll>();
            }
            nk[a].emplace_back(i);
            for(pair<ll, vector<ll>> p: nk) {
                if (k.count(p.first) == 0){
                    k[p.first] = vector<ll>();
                }
                for (ll l : p.second){
                    k[p.first].emplace_back(l);
                }
            }
        }
    }
    p(ans);

    return 0;
}