#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, mod(998244353);
  cin >> n >> s;
  int arr[3000];
  for (int i = 0; i < n; ++i) cin >> arr[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(s + 1, 0));
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= s; ++j) {
      if (j == arr[i - 1])
        dp[i][j] = i;
      else if (j > arr[i - 1]) {
        long long sum = 0;
        for (int k = 0; k < i; ++k) {
          sum += dp[k][j - arr[i - 1]];
          sum %= mod;
        }
        dp[i][j] = sum;
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; ++i) sum += (n - i + 1) * dp[i][s];
  cout << sum;
  return 0;
}
