#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << ' ' << H;
  debug_out(T...);
}
const long long INF = 1e9;
const long long MOD = 998244353;
const int N = 3e3 + 5;
int A[N], DP[N][N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  mt19937 Rnd(time(0));
  int n, s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    DP[i][A[i]] = i;
    for (int j = A[i]; j <= s; j++)
      DP[i][j] = (DP[i][j] + DP[i - 1][j - A[i]]) % MOD;
    ans = (ans + DP[i][s] * (n - i + 1) % MOD) % MOD;
    for (int j = 1; j <= s; j++) DP[i][j] = (DP[i][j] + DP[i - 1][j]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
