#include <bits/stdc++.h>
using namespace std;
mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
inline void chkmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
inline void chkmin(T &x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < 48) c = getchar();
  while (c > 47) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x;
}
const int maxn = 3010, P = 998244353;
int n, m, a[maxn], dp[2][maxn];
int main() {
  cin >> n >> m;
  for (int i = (1), iend = (n); i <= iend; ++i) a[i] = read();
  int sel = 1, res = 0;
  for (int i = (1), iend = (n); i <= iend; ++i) {
    memset(dp[sel], 0, sizeof dp[sel]);
    if (a[i] <= m) dp[sel][a[i]] = i;
    for (int j = (0), jend = (m); j <= jend; ++j) {
      dp[sel][j] = (dp[sel][j] + dp[sel ^ 1][j]) % P;
      if (j >= a[i]) dp[sel][j] = (dp[sel][j] + dp[sel ^ 1][j - a[i]]) % P;
    }
    if (a[i] <= m) {
      res =
          (res + 1ll * (n - i + 1) * (dp[sel ^ 1][m - a[i]] + (m == a[i]))) % P;
    }
    sel ^= 1;
  }
  cout << res;
  return 0;
}
