#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 3e3 + 10;
const int maxS = 3e3 + 10;
const long long mod = 998244353;
int n, s, a[maxN];
long long dp[maxS], ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> s;
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= (int)(n); ++i) {
    dp[0] = i;
    if (s >= a[i]) {
      ans += dp[s - a[i]] * (n - i + 1) % mod;
      if (ans >= mod) {
        ans -= mod;
      }
    }
    for (int j = s; j >= a[i]; --j) {
      dp[j] += dp[j - a[i]];
    }
  }
  cout << ans;
  return 0;
}
