#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 3e3 + 5;
const long long int mod = 998244353;
const long long int inf = 1e9 + 9;
long long int a[N], endat[N][N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, s;
  cin >> n >> s;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    endat[i][a[i]] = i;
    for (long long int j = 0; j <= s; j++) {
      endat[i][j] += endat[i - 1][j];
      if (a[i] <= j) endat[i][j] += endat[i - 1][j - a[i]];
    }
  }
  for (long long int i = 1; i <= n; i++) {
    if (s >= a[i]) ans += ((endat[i - 1][s - a[i]]) * (n - i + 1)) % mod;
    ans %= mod;
  }
  cout << ans;
  return 0;
}
