#include <bits/stdc++.h>
using namespace std;
long long int a[3005], dp[3005][3005], val[3005], hell = 998244353;
long long int add(long long int a, long long int b) {
  a += b;
  if (a > hell) a -= hell;
  return a;
}
void solve() {
  long long int n, s, res = 0;
  cin >> n >> s;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  for (long long int i = 1; i <= n; i++)
    for (long long int j = 1; j <= s; j++)
      if (j == a[i]) {
        dp[i][j] = add(dp[i - 1][j], i);
        if (j == s) res = add(res, (i * (n - i + 1)) % hell);
      } else {
        dp[i][j] = add(dp[i - 1][j], dp[i - 1][j - a[i]]);
        if (j == s) res = add(res, (dp[i - 1][j - a[i]] * (n - i + 1)) % hell);
      }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int q = 1;
  for (long long int i = 1; i <= q; i++) solve();
}
