#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 998244353;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

ll dp[3010][3010][3010];
int main()
{
    int n, s;
    cin >> n >> s;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a.at(i);
    }

    ll sum = 0;
    for (int start = 0; start < n; start++) {
        dp[start][start][a.at(start)] = 1;
        if (a.at(i) == s) {
            sum++;
        }
    }

    for (int start = 0; start < n; start++) {
        for (int end = start + 1; end < n; end++) {
            dp[start][end][s] = (((dp[start][end][s] % MOD) + (dp[start + 1][end][s - a.at(start)] % MOD)) % MOD + dp[start + 1][end][s] % MOD) % MOD;
            sum += dp[start][end][s];
            sum = sum % MOD;
        }
    }
    cout << sum << endl;
}