#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
const double PI = acos(-1);
const double eps = (1e-9);
const long long int INF = 2e9;
const int M = 998244353;
const int N = 3005;
int dp[N][N];
int add(int a, int b) {
  int s = a + b;
  if (s >= M) s -= M;
  return s;
}
long long int pro(long long int a, long long int b) { return (a * b) % M; }
int v[N];
void solve() {
  int i, n, s, a, j;
  scanf("%d%d", &n, &s);
  for (i = 1; i <= n; ++i) scanf("%d", &v[i]);
  long long int ans = 0;
  for (i = 0; i < n + 1; ++i) dp[i][0] = i + 1;
  for (i = 1; i <= n; ++i) {
    a = v[i];
    for (j = 1; j < s + 1; ++j) {
      if (j < a)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = add(dp[i - 1][j], dp[i - 1][j - a]);
    }
    ans += pro(dp[i - 1][s - a], n - i + 1);
  }
  cout << ans % M << "\n";
}
int main() {
  int t = 1;
  while (t--) solve();
}
