#include <bits/stdc++.h>
using namespace std;
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;
}
const long long maxn = 3100;
const long long mod = 998244353;
long long dp[maxn][maxn], n, s, a[maxn], ans = 0;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  cin >> n >> s;
  for (int i = 1; i <= (int)(n); ++i) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; ++i) {
    for (int j = a[i]; j <= s; ++j) {
      dp[i][j] = (dp[i - 1][j - a[i]] + dp[i - 1][j]) % mod;
    }
    dp[i][a[i]] = (dp[i][a[i]] + i) % mod;
    ans = (ans + dp[i][s]) % mod;
  }
  cout << ans << '\n';
  return 0;
}
