#include <bits/stdc++.h>
using namespace std;
int N, S;
long long const mod = 998244353;
long long a[3100] = {};
long long dp[3100] = {};
int main() {
  cin >> N >> S;
  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
  }
  long long res = 0;
  for (int i = 1; i <= N; ++i) {
    dp[0] += 1;
    for (int j = 1; j <= S; ++j) {
      if (j < a[i]) continue;
      dp[j] = (dp[j] + dp[j - a[i]]) % mod;
    }
    if (a[i] < S) res = (res + dp[S - a[i]] * (N - i) % mod) % mod;
  }
  res = (res + dp[S]) % mod;
  cout << res << '\n';
}
