#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？
ll N, S, A[3010];
ll mod = 998244353;
ll mm[3010][3010];
int main () {
    cin >> N >> S;
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        if (A[i] > S) continue;
        mm[i][A[i]] = 1;
        for (int j = 1; j < i; j++) {
            for (int k = S; k-A[i] >= 0; k--) {
                mm[j][k] += mm[j][k-A[i]];
            }
            ans += mm[j][S]*j;
            ans %= mod;
        }
        ans += mm[i][S]*i;
        ans %= mod;
    }
    cout << ans << endl;
}