#include <bits/stdc++.h>
using namespace std;
void print(vector<long long> v) {
  for (int x : v) printf("%d ", x);
  printf("\n");
}
template <class T>
void print(const T& t) {
  cout << t << "\n";
}
template <class T, class... Ts>
void print(const T& t, const Ts&... ts) {
  cout << t;
  if (sizeof...(ts)) cout << " ";
  print(ts...);
}
int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  long long cnt = 0;
  for (int i = 0; i < (n); i++)
    if (a[i] == s) (cnt += (i + 1) * (n - i)) %= 998244353;
  if (0) print(cnt);
  vector<long long> dp(s + 1, 0);
  dp[0] = 1;
  dp[s] = cnt;
  for (int i = 0; i < (n); i++) {
    if (0) printf("i:%d\n", i);
    if (a[i] > s) continue;
    int b = a[i];
    (dp[s] += dp[s - b] * (n - i) % 998244353) %= 998244353;
    for (int k = s - b - 1; k >= 0; k--) {
      (dp[k + b] += dp[k]) %= 998244353;
    }
    dp[a[i]] += i;
    if (0) print(dp);
  }
  print(dp[s]);
}
