#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
const int N = 3e3 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, s, a[N], dp[N][N], ans;
void add(int &a, int b) {
  a += b;
  if (a < mod2) a += mod2;
  a %= mod2;
}
int main() {
  if (fopen("threesum"
            ".in",
            "r"))
    freopen(
        "threesum"
        ".in",
        "r", stdin),
        freopen(
            "threesum"
            ".out",
            "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; i += 1) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i += 1) {
    for (int j = s - a[i]; j >= 0; j -= 1) add(dp[i][j + a[i]], dp[i - 1][j]);
    add(dp[i][0], 1);
    add(ans, ((n - i + 1) * dp[i][s] % mod2));
    for (int j = 0; j <= s; j += 1) add(dp[i][j], dp[i - 1][j]);
  }
  cout << ans;
  return 0;
}
