#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, M = (long long int)1e9 + 1;
const int mod = (long long int)998244353, sz = 5, MAX = (long long int)1e6 + 10;
string fir = "Monocarp", sec = "Bicarp";
void work() {
  long long int n, second;
  cin >> n >> second;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int dp[n][second + 1], prefix[second + 1];
  memset(dp, 0, sizeof(dp));
  memset(prefix, 0, sizeof(prefix));
  for (long long int i = 0; i < n; i++) dp[i][a[i]] = i + 1;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j <= second; j++) {
      if (j >= a[i]) {
        dp[i][j] += prefix[j - a[i]];
        dp[i][j] %= mod;
      }
    }
    for (long long int j = 0; j <= second; j++) {
      prefix[j] += dp[i][j];
      prefix[j] %= mod;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    ans = (ans + ((n - i) * (dp[i][second])) % mod) % mod;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    work();
  }
  return 0;
}
