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