#include <bits/stdc++.h>
using namespace std;
int n, s, a[3001];
long long ans, f[3001][3001];
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= s; j++)
      f[i][j] =
          f[i - 1][j] +
          (j < a[i] ? 0 : f[i - 1][j - a[i]] + (j == a[i] ? i : 0) % 998244353);
  for (int i = 1; i <= n; i++) {
    if (s == a[i]) ans = ans + 1ll * i * (n - i + 1) % 998244353;
    if (s > a[i])
      ans = ans + 1ll * f[i - 1][s - a[i]] * (n - i + 1) % 998244353;
  }
  cout << ans;
}
