#include <bits/stdc++.h>
using namespace std;
const long long maxs = 1e6 + 5;
const long long lmaxs = 20;
long long mod = 1e9 + 7;
long long oo = 1e15;
const int MAX = 3005;
long long dp[MAX][MAX];
void solve() {
  mod = 998244353;
  long long n, s;
  cin >> n >> s;
  long long ans = 0;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    memcpy(dp[i], dp[i - 1], sizeof dp[0]);
    (dp[i][a[i]] += i) %= mod;
    for (long long j = 0; j + a[i] <= s; j++) {
      (dp[i][j + a[i]] += dp[i - 1][j]) %= mod;
    }
    ans += dp[i][s];
    ans %= mod;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
