#include <bits/stdc++.h>
using namespace std;
long long dp[3010][3010];
int main() {
  long long n, s;
  cin >> n >> s;
  memset((dp), (0), sizeof(dp));
  vector<long long> v;
  for (long long i = (0); i < (n); ++i) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  dp[0][0] = 1;
  long long ans = 0;
  for (long long i = (1); i < (n + 1); ++i) {
    long long a = v[i];
    for (long long j = (1); j < (3005); ++j) {
      if (j + a > 3002) {
      } else {
        dp[i][j + a] += dp[i - 1][j] * (i + 1);
        dp[i][j + a] %= 998244353;
      }
      dp[i][j] += dp[i - 1][j];
      dp[i][j] %= 998244353;
    }
    ans += dp[i][s] * (n - i);
    ans %= 998244353;
  }
  cout << ans << endl;
  return 0;
}
