#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int dp[3030][3030];
int a[200010];
long long ans;
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= s; j++) {
      dp[i][j] = dp[i - 1][j];
    }
    for (int j = a[i]; j <= s; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - a[i]] % mod;
    }
    dp[i][a[i]] = dp[i][a[i]] + i % mod;
    ans = (ans + dp[i][s]) % mod;
  }
  cout << ans << endl;
  return 0;
}
