#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e3 + 5;
long long dp[MAX_N][MAX_N];
long long cdp[MAX_N][MAX_N];
long long arr[MAX_N];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][arr[i]] = i;
    for (int j = arr[i] + 1; j < MAX_N; j++) dp[i][j] = dp[i - 1][j - arr[i]];
    for (int j = 0; j < MAX_N; j++) cdp[i][j] = cdp[i - 1][j] + dp[i][j];
    ans += dp[i][s] * (n - i + 1);
    ans = ans % 998244353;
  }
  cout << ans << endl;
  return 0;
}
