#include <bits/stdc++.h>
using namespace std;
const int NN = 1e6 + 7;
const int N = 3e3 + 7;
const int M = 20;
const int mod = 998244353;
const long long inf = 1e18 + 7;
const double long rf = 1e-14;
int n, s;
int a[N];
int d[N][N];
int sum[N][N];
void solve1() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    d[i][a[i]] = i;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = a[i]; j <= s; j++) {
      d[i][j] = (d[i][j] + sum[i - 1][j - a[i]]) % mod;
    }
    for (int j = 0; j <= s; j++) {
      sum[i][j] = (sum[i - 1][j] + d[i][j]) % mod;
    }
    ans = (ans + d[i][s] * (n - i + 1) % mod) % mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  int cghf = 1;
  while (cghf--) {
    solve1();
  }
}
